Time travel -
07-26-2010
, 01:31 PM
I was playing with the generate_series function which, as everybody knows,
can use dates, as of the version 8.4. What I didn't realize is that it
can also go backwards:
mgogala=# select generate_series('2011-01-01'::date,
'2010-07-01'::date,
'-1 month');
generate_series
------------------------
2011-01-01 00:00:00-05
2010-12-01 00:00:00-05
2010-11-01 00:00:00-04
2010-10-01 00:00:00-04
2010-09-01 00:00:00-04
2010-08-01 00:00:00-04
2010-07-01 00:00:00-04
(7 rows)
Time: 1.402 ms
mgogala=#
Now, that's kewl!
--
http://mgogala.byethost5.com |