I am doing a query in which I want the last one hour data. [E:g:
StartTime is the
DateTime column of format (MM/dd/yyyy HH:mm:ss ).First, I am converting the StartTime to a different Timezone AS RunTime.
To find last 1 hour data followed by one other Logic to filter, I tried using the below conditions:
- WHERE StartTime BETWEEN DATEADD(HOUR, -1, GETDATE()) AND GETDATE()
AND info like 'Could not start.%'
OR WHERE StartTime = DATEADD(HOUR, -1, GETDATE())
AND info like 'Account locked.%'
If I execute the query at 8pm, I want the last hour data from 7-8pm , but this returns result from 4pm, 3pm also.
Am I expecting the right result?