Re: DATE SQL

From: Mark Lewis <mark(dot)lewis(at)mir3(dot)com>
To: wanpeng <wanp2005(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: DATE SQL
Date: 2006-03-06 17:04:10
Message-ID: 1141664650.17684.143.camel@archimedes
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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(at)gmail(dot)com
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

In response to

  • DATE SQL at 2006-03-06 10:39:09 from wanpeng

Browse pgsql-jdbc by date

  From Date Subject
Next Message David Fetter 2006-03-07 16:35:11 Re: DATE SQL
Previous Message Dave Cramer 2006-03-06 12:55:15 Re: JDBC support for 8.1 OUT parameters