Omnus Ruthius Omnus Ruthius - 5 months ago 16
SQL Question

How do I get data between midnight today and NOW?

As the title suggests, I'm simply trying to get the result set between midnight today and right now. So given the time of this post, I want data between 06/30/16 00:00:00 and 06/30/16 15:52:00. Why does the below query not return anything? Thanks.

SELECT * FROM tableName
WHERE event_date >= TO_DATE(TRUNC(SYSDATE) || ' 00:00:00', 'DD-MON-YY HH24:MI:SS')
AND event_date <= TO_DATE(TRUNC(SYSDATE))

MT0 MT0
Answer
SELECT *
FROM   tableName
WHERE  event_date BETWEEN TRUNC(SYSDATE) AND SYSDATE;
Comments