Search Postgresql Archives

Re: create a 'range' of dates/numbers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In response to Erwin Moller :
> Hi,
> 
> Is it possible to create a range of dates or numbers inside a query 
> without wrining in procedural language?
> I am looking for something that creates some kind of 'temp table' inside 
> a query.
> eg:

generate_Series():

test=# select * from generate_Series(1,5);
 generate_series
-----------------
               1
               2
               3
               4
               5
(5 rows)

test=*# select current_date + s * '1day'::interval  from
generate_Series(1,5)s;
      ?column?
---------------------
 2008-12-20 00:00:00
 2008-12-21 00:00:00
 2008-12-22 00:00:00
 2008-12-23 00:00:00
 2008-12-24 00:00:00
(5 rows)


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux