Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: query last n hours / minutes
On 2005-07-29, Harry <harryooopotter_at_hotmail.co_> wrote:
> I have an Oracle 9 table with a field performed_date.
>
> Select * from my_table
> where performed_date > (sysdate - 8);
>
> This will return all records with performed_date within last week.
>
> What is the query for "last 4 hours"?
>
> What is the query for "last 30 minutes"?
That sounds a lot like homework.
So, sysdate-1 returns all rows in the
last 24 hours. sysdate-1/6 will
return all row in the last 24/6 hours
(=4 hours).
Did that help?
-- Rene Nyffenegger http://www.adp-gmbh.ch/Received on Fri Jul 29 2005 - 00:43:27 CDT