在 SAP HANA 表中使用根据小时分组


您可以尝试此方法将时间转换为日期和小时格式 −

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);

您还可以尝试将 Series_Round() 与分组子句一起使用。

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');


更新时间: 2020-02-26

513 次浏览

开启您的 职业生涯

完成课程以获得认证

开始学习
广告
© . All rights reserved.