sql - How to get the records in last 24 hrs when the query is run at 00:05 hrs -


how records in last exact 24 hrs?

select * table1 sentdate >= sysdate - 1  

when ran above query @ 00:05 hrs, returning records in last 5 minutes. need fetch records in last exact 24 hrs when query run.

how can achieved in sql/oracle there way similar to

select * table1 sentdate >= sysdate - 24 hrs ? 

running @ 5 minutes past suggests you're looking "yesterday", be:

sentdate >= trunc(sysdate)-1 , sentdate <  trunc(sysdate) 

if want exact last 24 hours then:

sentdate >= sysdate-1 , sentdate <  sysdate 

or:

sentdate >  sysdate-1 , sentdate <= sysdate 

be careful of boundary conditions, hence using >= , <, or > , <= in above.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -