年月分组
select to_char(collection_time ,"yyyy-mm") AS date, cast(SUM(a.stage_value)as DOUBLE) as stage_value from TABLE GROUP BY `date`
年月日分组
select to_char(collection_time ,"yyyy-mm-dd") AS date, SUM(a.stage_value)as DOUBLE) as stage_value from TABLE GROUP BY `date`
年月日小时分组
select CONCAT(to_char(a.collection_time ,"yyyy-mm-dd"),' ',to_char(a.collection_time ,"HH24"))AS date, cast(SUM(a.stage_value)as DOUBLE) as stage_value from TABLE GROUP BY `date`
to_char(yyyy-mm-dd hh) 会有问题。所以用年月日 加24小时制两个字符串合并成一个时间。