Query return data between two fixed points in time.
I have a table with a datestamp column which indicates wheren the record was written to the database table.
I am trying to write a query that will return all records that are in a date range between 6am (today) and 6am (a week ago).
I understand how to do the date range part however unsure how to enforce the 6am condition.
The query needs to be able to be run without changing the query on a regular basis. I should be able to run the query at any time during the day and it should stick to return only records between 6am 7 days ago and 6am today.
i have written thusfar
Last edited by mozart; 11-15-2006 at 05:18 PM.
BETWEEN (trunc(sysdate) - 7 )+6/24
What about this?
BETWEEN TRUNC(sysdate) - 7 + 6/24
AND to_date(reportdate,'DD/MM/YYYY') + 6/24;
this space intentionally left blank
Click Here to Expand Forum to Full Width