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) - 1/24 == yesterday at 23:00
TRUNC(SYSDATE) - 1/48 == yesterday at 23:30
Thus:
select mycol
from mytable
where mydate between TRUNC(SYSDATE) - 1/24 and TRUNC(SYSDATE) - 1/48;
should produce the results you're after.
David Fitzjarrell Received on Mon Nov 06 2006 - 12:58:14 CST