select trunc_timestamp(wi10201i, 'HH'), count(*), max(WI10201T)
from (select * from oa1p.twi102a1
where wi10201i > current timestamp - 10 days
and WI10201T <= 'AG22'
-- fetch first 10000 rows only
) x
group by trunc_timestamp(wi10201i, 'HH')
order by 1 desc
with ur