-- if recording spans two days, give Hours After Midnight as 1 plus last hour
-- sampled (midnight has an hour of 0)
if(count(distinct day(a.Hour)) = 2, hour(max(a.Hour)) + 1, 0) as HoursAfterMidnight,
But this fails for recordings are paused overnight, e.g.,
I should just write conditional that would ignore rows if Hour < 6 or 22 <= Hour and not worry about counting how many rows after after midnight.
HoursAfterMidnight
is calculated withBut this fails for recordings are paused overnight, e.g.,
I should just write conditional that would ignore rows if Hour < 6 or 22 <= Hour and not worry about counting how many rows after after midnight.