日期:2014-05-17 浏览次数:20846 次
SELECT * FROM stu ORDER BY classid, studentid;
------解决方案--------------------
SQL> with TAB as 2 (select 1 cid,1 sid,'张三' name from dual 3 union all 4 select 2 cid,2 sid,'李四' name from dual 5 union all 6 select 1 cid,3 sid,'王五' name from dual 7 union all 8 select 3 cid,4 sid,'王二' name from dual 9 union all 10 select 2 cid,5 sid,'小李' name from dual) 11 select * from TAB order by cid,sid; CID SID NAME ---------- ---------- ---- 1 1 张三 1 3 王五 2 2 李四 2 5 小李 3 4 王二 SQL>
------解决方案--------------------
select * from tname order by classid,studentid;