From: Mark Lewis <mark.lewis@mir3.com>
To: wanpeng <wanp2005@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: DATE SQL
Date: Mon, 06 Mar 2006 09:04:10 -0800
Message-ID: <1141664650.17684.143.camel@archimedes> (raw)
In-Reply-To: <01ec01c6410a$36814e00$4d06050a@WANP>
References: <01ec01c6410a$36814e00$4d06050a@WANP>
Well, in pure SQL I don't think you could do it without resorting to
ugly tricks like defining an all_days table that had one row per day in
your range, then doing something like, "select from all_days a join xxx
x where a.day >= x.start_date and a.day <= x.end_date"
So . . . don't do that. What you want isn't really a pure relational
operation, so SQL isn't the right language for it. Either do it in your
application code, or write a server-side function.
In either case, this is more of a pgsql-general question, since it's not
specific to JDBC at all.
-- Mark Lewis
On Mon, 2006-03-06 at 18:39 +0800, wanpeng wrote:
> I want a result like
>
> '2006-03-01'
> '2006-03-02'
> '2006-03-03'
> '2006-03-04'
>
>
> FROM table xxx
>
> ……| start_date | end_date |……
> | '2006-03-01' | '2006-03-04'|
>
> how can I write the sql
>
> thanks
>
> -----------------------------------------------
> wanp2005@gmail.com
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mark.lewis@mir3.com, wanp2005@gmail.com
Subject: Re: DATE SQL
In-Reply-To: <1141664650.17684.143.camel@archimedes>
References: <01ec01c6410a$36814e00$4d06050a@WANP> <1141664650.17684.143.camel@archimedes>
* 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