首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

关于查询语句按两个字段排序有关问题,不知道可不可以,求指点!

2012-03-29 
关于查询语句按两个字段排序问题,不知道可不可以,求大虾指点!!!!!查询语句SQL codeSQL codeselect stateID

关于查询语句按两个字段排序问题,不知道可不可以,求大虾指点!!!!!
查询语句

SQL code
SQL codeselect stateID,stepID from pro1 where code=217 group by stateid,stepID order by stateid,stepID desc
查出来的结果是
stateID stepID:
1 2
1 1
1 0
2 1
2 0
我想要的结果是:
stateID stepID
2 1
2 0
1 2
1 1
1 0

上面的语句怎么改,求大虾指点!!!!!!!!!!!

[解决办法]
额 不好意思 看错了



可以得出结果的
[解决办法]
select stateID,stepID from pro1 where code=217 group by stateid,stepID order by stepID,stateid desc
试试看
[解决办法]
order by stateid DESC ,stepID desc


[解决办法]
该是stateid 降序
select stateID,stepID from pro1 where code=217 group by stateid,stepID order by stateid desc,stepID desc
[解决办法]
stateid desc,stepID desc 两个字段都降序排列


[解决办法]
order by stateid ASC,stepID DESC

热点排行