The easiest way is to group by two columns:
CAST(row_added_ts AS DATE), EXTRACT(HOUR FROM row_added_ts)
You can also cast to a string, but your format will not allow correct sorting:
to_char(row_added_ts , 'mm/dd/yyyy HH12 PM')
Internationla standard format sorts ok:
to_char(row_added_ts , 'yyyy-mm-dd HH24')
Or you cast to a string & back:
cast(to_char(row_added_ts , 'yyyy-mm-dd HH24') as timestamp(0) format 'yyyy-mm-ddBhh')
Or you subtract minutes & seconds:
row_added_ts
- (extract(minute from row_added_ts) * interval '1' minute)
- (extract(second from row_added_ts) * interval '1' second)
The easiest way is to group by two columns:
CAST(row_added_ts AS DATE), EXTRACT(HOUR FROM row_added_ts)
You can also cast to a string, but your format will not allow correct sorting:
to_char(row_added_ts , 'mm/dd/yyyy HH12 PM')
Internationla standard format sorts ok:
to_char(row_added_ts , 'yyyy-mm-dd HH24')
Or you cast to a string & back:
cast(to_char(row_added_ts , 'yyyy-mm-dd HH24') as timestamp(0) format 'yyyy-mm-ddBhh')
Or you subtract minutes & seconds:
row_added_ts
- (extract(minute from row_added_ts) * interval '1' minute)
- (extract(second from row_added_ts) * interval '1' second)