Using Group by hour in SAP HANA table


You can try this method to convert time to date and hour format −

select to_varchar(time, 'YYYY-MM-DD'), hour(time),
sum(r_time) as r_time, sum(p_time) as p_time from t1
group by date(time), hour(time)
order by to_varchar(time, 'YYYY-MM-DD'), hour(time);

You can also try using Series_Round() with a group by clause.

select SERIES_ROUND(time, 'INTERVAL 1 HOUR') as time,
sum(r_time) as r_time, sum(p_time) as p_time from t1
group by SERIES_ROUND(time, 'INTERVAL 1 HOUR')
order by SERIES_ROUND(time, 'INTERVAL 1 HOUR');


Updated on: 26-Feb-2020

407 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements