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

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: create a 'range' of dates/numbers?
Date: 2008-12-19 10:33:35
Message-ID: 20081219103335.GA9040@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2008-12-19 10:40:23 Re: How are locks managed in PG?
Previous Message Raymond O'Donnell 2008-12-19 10:32:29 Re: create a 'range' of dates/numbers?