Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f56FrEE95365 for ; Wed, 6 Jun 2001 11:53:14 -0400 (EDT) (envelope-from josh@agliodbs.com) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.4.1) with HTTP id 67924; Wed, 06 Jun 2001 08:53:08 -0700 From: "Josh Berkus" Subject: Re: seleting all dates between two dates To: "Jeff Barrett" , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.4.1 Date: Wed, 06 Jun 2001 08:53:08 -0700 Message-ID: In-Reply-To: <9f8pg1$kem$1@news.tht.net> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200106/64 X-Sequence-Number: 3277 Jeff, > I am interested in a query where I can select all dates between two > dates. I > figure I can build a table of all valid dates with a resonable range > and > then select from that table, but I would like to use the power of sql > to get > the work done without building a date table. Any ideas? > > For example: > I want all dates between 05-29-2001 and 06-02-2001 > The result set would be: > 05-30-2001 > 05-31-2001 > 06-01-2001 If you browse last week's postings, you will find a thread called "SQL Date Challenge" with that very issue. The answer, in short, is that you can't do it in SQL. Your choices are to build the reference table, or to use and external procedural language (such as Perl). -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete information technology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco