pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDatetime Query
2+ messages / 2 participants
[nested] [flat]
* Datetime Query
@ 2001-02-15 15:31 Mark Byerley <mrbyerle@uwaterloo.ca>
0 siblings, 1 reply; 2+ messages in thread
From: Mark Byerley @ 2001-02-15 15:31 UTC (permalink / raw)
To: pgsql-sql
I need to create a query which will select a request_no between Data1 and
Date2 so...
SELECT request_no FROM request where status_code ='C' and (completed_date
between 01/01/2000 and 01/01/2001);
The problem I have run into is that the completed_date field is a datetime
format (not by my own design) and I am having some problems extracting just
the request_no's between those dates.
I have tried a few extract month,day,year clauses with no success. If
anyone has an idea I would appreciate it!
Thanks in advance.
Mark
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Datetime Query
@ 2001-02-16 21:45 Jie Liang <jliang@ipinc.com>
parent: Mark Byerley <mrbyerle@uwaterloo.ca>
0 siblings, 0 replies; 2+ messages in thread
From: Jie Liang @ 2001-02-16 21:45 UTC (permalink / raw)
To: Mark Byerley <mrbyerle@uwaterloo.ca>; +Cc: pgsql-sql
Try:
SELECT request_no FROM request where status_code ='C' and
(completed_date::date
between '01/01/2000'::date and '01/01/2001'::date)
actually date('01/01/2000') does same thing as '01/01/2000'::date
Jie LIANG
St. Bernard Software
Internet Products Inc.
10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873
jliang@ipinc.com
www.stbernard.com
www.ipinc.com
On Thu, 15 Feb 2001, Mark Byerley wrote:
> I need to create a query which will select a request_no between Data1 and
> Date2 so...
>
> SELECT request_no FROM request where status_code ='C' and (completed_date
> between 01/01/2000 and 01/01/2001);
>
> The problem I have run into is that the completed_date field is a datetime
> format (not by my own design) and I am having some problems extracting just
> the request_no's between those dates.
> I have tried a few extract month,day,year clauses with no success. If
> anyone has an idea I would appreciate it!
> Thanks in advance.
> Mark
>
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2001-02-16 21:45 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-02-15 15:31 Datetime Query Mark Byerley <mrbyerle@uwaterloo.ca>
2001-02-16 21:45 ` Jie Liang <jliang@ipinc.com>
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