-- select records from the last day
select count(*) from table where some_date > sysdate - 1;
-- Select records from the last 3 hours
select count(*) from table where some_date > sysdate - 3/24;
Starting in 9i there's another way to do this.
-- select records from the last day
select count(*) from table where some_date > sysdate - interval '1' day;
-- Select records from the last 3 hours
select count(*) from table where some_date > sysdate - interval '3' hour;
No comments:
Post a Comment