I’m looking to retrieve data from a a table, between YESTERDAY (starting at 4am) and TODAY (ending at 4am). What is the best way to go about automating this? I am thinking perhaps grab today’s date and offsetting 4 hours and assign it to a variable? Currently manually entering the time/date each day.
Current code:
SELECT "HC_PRIME_REPORTDATA"."iReportDataID"
FROM "WinTest1"."dbo"."HC_PRIME_REPORTDATA" "HC_PRIME_REPORTDATA"
WHERE ("HC_PRIME_REPORTDATA"."dtTime">={ts '2011-10-19 04:00:00'} AND"HC_PRIME_REPORTDATA"."dtTime"<{ts '2011-10-20 04:00:00'})
Any help is greatly appreciated!
Here is one way to do it: