| From: | Richard Ellis <rellis9(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-bugs <pgsql-bugs(at)postgresql(dot)org> |
| Subject: | Re: is this my date problem |
| Date: | 2003-10-02 11:31:22 |
| Message-ID: | 20031002113122.GF2570@i386.dp100.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Wed, Oct 01, 2003 at 07:57:18PM -0700, Theodore Petrosky wrote:
> here is the actual query:
>
> agencysacks=# SELECT jobnumseq, (SELECT cname FROM
> clientinfo ci WHERE ci.acode = j.clientid) as client,
> shrtdesc, to_char(proofduedate, 'Dy FMMon DD, YYYY
> HH12 am') FROM jobs j WHERE proofduedate BETWEEN
> to_timestamp('01 October 2003 00:01', 'DD Month YYYY
> HH24:MI') AND to_timestamp ('01 October 2003 23:59',
> 'DD Month YYYY HH24:MI') ORDER BY client,
>...
> I am trying to create a 'today' type query. between
> october 1, 2003 00:01 am and october 1, 2003 23:59
If you want a "today" type query, why are you using between? This
should work, and be a whole lot more reliable:
SELECT jobnumseq, (SELECT cname
FROM clientinfo ci
WHERE ci.acode = j.clientid) as client,
shrtdesc,
to_char(proofduedate, 'Dy FMMon DD, YYYY HH12 am')
FROM jobs j
WHERE date(proofduedate) = '2003-10-01')
ORDER BY client,
or if you want to derive "today" automatically this should work:
SELECT jobnumseq, (SELECT cname
FROM clientinfo ci
WHERE ci.acode = j.clientid) as client,
shrtdesc,
to_char(proofduedate, 'Dy FMMon DD, YYYY HH12 am')
FROM jobs j
WHERE date(proofduedate) = date(now()))
ORDER BY client,
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Theodore Petrosky | 2003-10-02 12:15:39 | Re: is this my date problem |
| Previous Message | Max Kellermann | 2003-10-02 10:16:04 | 7.3.4: memory leak in fe-exec.c:279 (realloc) |