SQLTeam.com | Weblogs | Forums

Where clause to query records from current day

I am trying to create an automated query that will display reports from the current day. I can do this manually each day, but have not been able to figure out how to automate the date input. This is what i have so far

where reportdate between to_timestamp ('2022-10-24 00:00:00.000' , 'YYYY-MM-DD HH24:MI:SS.FF') and to_timestamp ('2022-10-24 23:59:59.999' , 'YYYY-MM-DD HH24:MI:SS.FF')

This works for the day specified, but I need a way to make the query automatically pick the date, while leaving the times as they are.

SQLTeam is a Microsoft SQL Server site, we're not experts in Oracle.

It seems that you can accomplish what you're looking for using CURRENT_DATE and INTERVAL expressions, see here for some more detail: