当前位置: 代码迷 >> Sql Server >> 怎么使用sql语句实现某条数据显示在最前端
  详细解决方案

怎么使用sql语句实现某条数据显示在最前端

热度:10   发布时间:2016-04-27 15:37:20.0
如何使用sql语句实现某条数据显示在最前端


各位:好!!!
        有个问题需要大家帮忙,谢谢各位高手指点。

    我想写一个sql语句实现字段中Ostate=2的数据都显示在所有的数据最前面
如何实现,请帮帮忙!。

其中,Ostate   分别有,0、1、2、3这几种情况。

------解决方案--------------------
select * from tablename where Ostate=2
union all
select * from tablename where Ostate <> 2
------解决方案--------------------
select * from tablename where Ostate=2
union all
select * from tablename where Ostate <> 2

----
同意
  相关解决方案