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

求一名SQl语句??感谢
表a

a   b

3     0
2     1
7     0
8     1

怎么显示

a     b  
8     1
2     1
7     0
3     0

意思是先按b从大到小排..再按   a从大到小排....在一条语句中,....谢谢!!!

------解决方案--------------------
select * from 表 order by b desc,a desc
------解决方案--------------------
select * from 表 order by b desc,a desc

------解决方案--------------------
declare @t table(a int,b int)
insert @t
select 3, 0 union all
select 2, 1 union all
select 7, 0 union all
select 8, 1

select * from @t order by b desc,a desc

/*结果
a b
-------------
8 1
2 1
7 0
3 0
*/
------解决方案--------------------
select * from 表 order by b desc,a desc