multimpe records output from a 'no-table' source

Started by Rafal Pietrakover 19 years ago3 messagesgeneral
Jump to latest
#1Rafal Pietrak
rafal@zorro.isa-geek.com

Hi all,

There is this functions like 'current_date', 'current_database', etc.
yielding a row of data without any table to source rows from. Like:
dev=# SELECT current_date;
date
------------
2006-08-25
(1 row)

Is there a way to get multiple rows? Like:
dev=# SELECT current_date where date between now and yesterday;
date
------------
2006-08-24
2006-08-25
(2 rows)
(of cource this is 'cooked' example, as I haven't figured out how to
achieve this).
Or:
dev=# SELECT * where a::numeric between 1 and 3;
a
------------
1
3
2
(3 rows)

--
-R

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: Rafal Pietrak (#1)
Re: multimpe records output from a 'no-table' source

On Fri, Aug 25, 2006 at 07:57:52AM +0200, Rafal Pietrak wrote:

Hi all,

There is this functions like 'current_date', 'current_database', etc.
yielding a row of data without any table to source rows from. Like:
dev=# SELECT current_date;
date
------------
2006-08-25
(1 row)

Not all functions require an input, as you see, so then you don't need
a table to get an output.

For the rest of your question, see generate_series();

http://www.postgresql.org/docs/8.1/static/functions-srf.html

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

From each according to his ability. To each according to his ability to litigate.

#3Rafal Pietrak
rafal@zorro.isa-geek.com
In reply to: Martijn van Oosterhout (#2)
Re: multimpe records output from a 'no-table' source

On Fri, 2006-08-25 at 08:02 +0200, Martijn van Oosterhout wrote:

For the rest of your question, see generate_series();

http://www.postgresql.org/docs/8.1/static/functions-srf.html

Thenx, That's exactly what I've needed!

--
-R