Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Query Date by Time

Re: Query Date by Time

From: <fitzjarrell_at_cox.net>
Date: 6 Nov 2006 10:58:14 -0800
Message-ID: <1162839493.964138.299400@m73g2000cwd.googlegroups.com>

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US