日期:2014-05-17 浏览次数:20867 次
with t1 as
(
select 1 c1,'A' c2,6 c3 from dual union all
select 2 c1,'A' c2,5 c3 from dual union all
select 3 c1,'A' c2,3 c3 from dual union all
select 4 c1,'A' c2,8 c3 from dual union all
select 5 c1,'B' c2,5 c3 from dual union all
select 6 c1,'B' c2,7 c3 from dual union all
select 7 c1,'B' c2,4 c3 from dual union all
select 8 c1,'B' c2,5 c3 from dual
)
select *
from t1
order by c2,c3 desc,c1
c1 c2 c3
-------------------------------
1 4 A 8
2 1 A 6
3 2 A 5
4 3 A 3
5 6 B 7
6 5 B 5
7 8 B 5
8 7 B 4