I have a query where I want to retrieve the records where a date falls between yesterday and 7 days ago. Because of the timestamp on the current_timestamp I am missing some records. The condition I am using is
where eventdate between current_timestamp-7 and current_timestamp-1
Event date has a timestamp of 00:00:00
Effectively if I run the query at 9am I miss all the records from midnight to 9am.
Is there any way I can just pull back the date?
In Oracle there is a trunc function that allows you to restrict the date to only the date part and by default it takes the time to be midnight regardles of the timestamp.
Susan
where eventdate between current_timestamp-7 and current_timestamp-1
Event date has a timestamp of 00:00:00
Effectively if I run the query at 9am I miss all the records from midnight to 9am.
Is there any way I can just pull back the date?
In Oracle there is a trunc function that allows you to restrict the date to only the date part and by default it takes the time to be midnight regardles of the timestamp.
Susan