Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Query Date by Time
Gomer wrote:
> Greetings,
>
> I'm pulling out my hair on this one.
>
> I want to create a query that pulls data by the previous date, between
> the hours 23:00 and 23:30.
>
> I've read through newsgroups for a couple of days, and I've gone
> through my Oracle manuals, to no avail.
>
> Can anyone offer a suggestions or two?
>
> Thanks,
> BKC
TRUNC(SYSDATE) is midnight, (TRUNC(SYSDATE) - 1/24) is 23:00 (11PM) on
the previous date. (TRUNC(SYSDATE) - 1/48) is 23:30 (11:30PM) on the
previous date.
The above implies:
WHERE
MY_COLUMN BETWEEN (TRUNC(SYSDATE) - 1/24) AND (TRUNC(SYSDATE) - 1/48)
Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc.
Received on Mon Nov 06 2006 - 13:01:28 CST