Re: Given 02-01-2006 to 02-28-2006, output all days. - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: Given 02-01-2006 to 02-28-2006, output all days.
Date
Msg-id 20060217212002.GA58573@winnie.fuhr.org
Whole thread Raw
In response to Given 02-01-2006 to 02-28-2006, output all days.  (Henry Ortega <juandelacruz@gmail.com>)
List pgsql-sql
On Fri, Feb 17, 2006 at 04:07:28PM -0500, Henry Ortega wrote:
> Is there a real quick way to do a query that will show me all the dates
> given a startdate and an end date?

You could use generate_series(), which is built-in since 8.0 and
easily written in earlier versions.

SELECT date'2006-02-01' + x
FROM generate_series(0, date'2006-02-28' - date'2006-02-01') AS g(x);

-- 
Michael Fuhr


pgsql-sql by date:

Previous
From: "Owen Jacobson"
Date:
Subject: Re: Given 02-01-2006 to 02-28-2006, output all days.
Next
From: "Owen Jacobson"
Date:
Subject: Re: Given 02-01-2006 to 02-28-2006, output all days.