谢谢。google了pivot table
其实就是用case when then else end 语句。还是query不熟。最后我写成
select count(case when (nvl(t.resolved_time, nvl(t.close_time,sysdate))- t.open_time) <= 4 then t.id else null end) as "<4",
count(case when (nvl(t.resolved_time, nvl(t.close_time,sysdate))- t.open_time) >4 and (nvl(t.resolved_time, nvl(t.close_time,sysdate))- t.open_time) <7 then t.id else null end) as "4-7",
count(case when (nvl(t.resolved_time, nvl(t.close_time,sysdate))- t.open_time) >=7 and (nvl(t.resolved_time, nvl(t.c