Need help for SQL Query last 5 mins Records.
597724Oct 18 2007 — edited Oct 18 2007I need the data between the last five minutes from a table which contains Timeid Column and data type is date.
select sysdate,(sysdate-((mod(extract(minutes from systimestamp),5)+5)/24/60)-((extract(second from systimestamp))/24/60/60)) Start_date,
(sysdate-((mod(extract(minutes from systimestamp),5))/24/60)-((extract(second from systimestamp))/24/60/60)) End_Date;
Suppose now the current time is 01:20:00PM then the output should be from
Current Date & Time Start Date & Time End Date & Time
10/18/2007 01:20:00 10/18/2007 01:10:01 10/18/2007 01:15:00
Suppose now the current time is 01:20:01 then the output should be from
Current Date & Time Start Date & Time End Date & Time
10/18/2007 01:20:01 10/18/2007 01:15:01 10/18/2007 01:20:00
The output i am getting where as i need the output shown above.
Current Date & Time Start Date & Time End Date & Time
10/18/2007 01:20:01 10/18/2007 01:14:59 10/18/2007 01:19:59