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
SELECT xxxx.table
FROM table
WHERE to_date(reportdate,'DD/MM/YYYY')
BETWEEN to_date(sysdate-7,'DD/MM/YYYY')
AND to_date(reportdate,'DD/MM/YYYY')
Thankyou