need some help) I have simple request:
SELECT uniq(DeviceId)
from events
where EventDateTime between '2020-12-28 00:00:00' and '2020-12-28 23:59:59'
Now, i need to find the same result with one hour shift:
SELECT uniq(DeviceId)
from events
where EventDateTime between '2020-12-27 00:23:00' and '2020-12-28 22:59:59'
And one hour more:
SELECT uniq(DeviceId)
from events
where EventDateTime between '2020-12-27 00:22:00' and '2020-12-28 21:59:59'
So, for 24h I need 24 requests - is there is way to do this in one request?
Expected result:
'2020-12-28 00:00:00' - '2020-12-28 23:59:59', 'uniqValue1'
'2020-12-27 00:23:00' - '2020-12-28 22:59:59', 'uniqValue2'
'2020-12-27 00:22:00' - '2020-12-28 21:59:59', 'uniqValue3'
...
'2020-12-27 00:00:00' - '2020-12-27 23:59:59, 'uniqValue24'