Yanwen
01/30/2023, 6:06 PMMayank
Yanwen
01/31/2023, 8:34 PMselect org_uuid, event_type, from_unixtime(updated_at / 3600 * 3600), count(*) from table
where org_uuid = 'x'
group by 1, 2 ,3
another
select org_uuid, event_type,
DATE_PART('YEAR', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _year,
DATE_PART('MONTH', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _month,
DATE_PART('DAY', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _day,
DATE_PART('HOUR', date_parse(updated_at_string, '%Y-%m-%d %H:%i:%s')) as _hour,
count(*) from table
where org_uuid = 'x'
group by 1, 2,
3,
4,
5,
6Yanwen
01/31/2023, 9:34 PMdate_trunc so I can only aggregate by unitMayank
Yanwen
02/08/2023, 1:47 PMdate_trunc it only allow me aggregate by one time unit(hour, day...) but if I want to to timewindow, such as 3 hours, 4 days etc, looks like I cannot use group byMayank