34,590
社区成员
发帖
与我相关
我的任务
分享
Select count(*) as count1 , 1 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=1
union
Select count(*) as count1 , 2 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=2 and ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >1
union
Select count(*) as count1 , 3 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=3 and ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >2
union
Select count(*) as count1 , 4 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >3
order by px
或者
select * from
(
Select count(*) as count1 , 1 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=1
union
Select count(*) as count1 , 2 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=2 and ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >1
union
Select count(*) as count1 , 3 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=3 and ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >2
union
Select count(*) as count1 , 4 px from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >3
) t
order by px
Select count(*) as count1 from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=1
union
Select count(*) as count1 from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=2 and ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >1
union
Select count(*) as count1 from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) <=3 and ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >2
union
Select count(*) as count1 from edr_cont_hold_release
Where cont_status in ('IF','EM') And HOLD_CONDITION = 'DT' And ROUND(TO_NUMBER(release_datetime - cont_in_tml_datetime)) >3
/*
1.请用sql代码发
2.排版请美观
建议你提供详细的资料:
例如表的结构,表之间的关系,测试数据,相关算法及需要的结果。
这样有助于我们理解你的意思,更主要的是能尽快让你获得答案或解决问题的方法。