日期:2014-05-17 浏览次数:20809 次
with t1 as ( select 1 id,1 div,1 num from dual union all select 1 id,2 div,1 num from dual union all select 2 id,1 div,3 num from dual union all select 2 id,2 div,3 num from dual union all select 3 id,1 div,2 num from dual union all select 3 id,2 div,2 num from dual ) select * from t1 order by num,div id div num --------------------------- 1 1 1 1 2 1 2 1 3 3 1 2 4 3 2 2 5 2 1 3 6 2 2 3
------解决方案--------------------
--如果每一组内num的值都是相同的话,这个sql就可以了 select * from t1 order by num,div