日期:2014-05-18  浏览次数:20653 次

表排序问题
存在以下一个表
      select   0,1
union   select   0,2
union   select   0,3
union   select   0,4
union   select   1,0
union   select   2,0
union   select   3,0
union   select   4,0
排序后要求变成  
0,1
1,0
0,2
2,0
0,3
3,0
0,4
4,0

该怎么样做啊?感觉不可能实现阿



------解决方案--------------------
--example
Select * from (
select 0 as ID1,1 as ID2
union select 0,2
union select 0,3
union select 0,4
union select 1,0
union select 2,0
union select 3,0
union select 4,0) as t
order by ID1+ID2,ID1