From: Michael Fuhr <mike@fuhr.org>
To: Henry Ortega <juandelacruz@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Given 02-01-2006 to 02-28-2006, output all days.
Date: Fri, 17 Feb 2006 14:20:02 -0700
Message-ID: <20060217212002.GA58573@winnie.fuhr.org> (raw)
In-Reply-To: <2bffcc330602171307i4b0c523eveeb6e3e4ecf1f46f@mail.gmail.com>
References: <2bffcc330602171307i4b0c523eveeb6e3e4ecf1f46f@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mike@fuhr.org, juandelacruz@gmail.com
Subject: Re: Given 02-01-2006 to 02-28-2006, output all days.
In-Reply-To: <20060217212002.GA58573@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox