I am working on a query that will be an automated job. It needs to find all the transactions between 8 PM and 8 PM for the last day. I was thinking of doing something like
DECLARE @start_date DATETIME DECLARE @end_date DATETIME SET @start_date = DATEADD(hour, 20, DATEDIFF(DAY, 2, GETDATE())) SET @end_date = @start_date + 1 select @start_date, @end_date