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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -