3,499
社区成员
发帖
与我相关
我的任务
分享 SELECT SUM(decode(n, '天', m)) "天", SUM(decode(n, '小时', m)) "小时"
FROM a;
with table_a as(
select 1 m,'天' n from dual
union all
select 2 m,'天' n from dual
union all
select 2 m,'小时' n from dual
union all
select 3 m,'小时' n from dual
)
select (select sum(m) from table_a t1 where t1.n = '天') day_count,
(select sum(m) from table_a t1 where t1.n = '小时') hour_count
from dual