Guest User

Untitled

a guest
Jul 20th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. select * from table_name where TIMESTAMP between trunc(sysdate-1) and
  2. trunc(sysdate-1) + 6/24 or timestamp between trunc(sysdate-1) + 23/24 and
  3. trunc(sysdate);
  4.  
  5. where yourColumn between trunc(sysdate -1) + 23/24 and trunc (sysdate) + 6/24
  6.  
  7. trunc(sysdate) -> today at 00:00 AM
  8. trunc(sysdate-1) -> yesterday at 00:00 AM
  9. trunc(sysdate-1) + 6/24 -> yesterday at 06:00 AM
  10. trunc(sysdate-1) + 18/24 -> yesterday at 06:00 PM
  11. ...
Add Comment
Please, Sign In to add comment