第1个回答 推荐于2018-03-23
select t.idate, t.t_num1, t1.t_num2
from (select to_char(idate, 'yyyy/mm/dd hh') || '点' as idate,
sum(t_num1) as t_num1
from a
group by to_char(idate, 'yyyy/mm/dd hh') || '点') t
left join (select to_char(idate, 'yyyy/mm/dd hh') || '点' as idate,
sum(t_num2) as t_num2
from a
group by to_char(idate, 'yyyy/mm/dd hh') || '点') t1
on a.idate = b.idate order by idate;
给你个例子,照你的情况改下表名和字段名应该就行了。本回答被提问者和网友采纳
第2个回答 2013-07-30
select to_char(t_date,'yyyy/mm/dd')||' '||to_char(t_date,'HH24')||'点' type,sum(t_num1) t_num1,sum(t_num2) t_num2 from Table group by to_char(t_date,'yyyy/mm/dd')||' '||to_char(t_date,'HH24')||'点'
第3个回答 2013-07-31
可以t_date 字段拆分为两个字段:"日期"和"时间"。然后就可以 select 日期,时间,sum(时间) from a group by 日期,时间
第4个回答 2013-07-31
(日期是不一样的,时间也是不一样的)?? 这句何解?
没看懂你的要求