请教一条sql语句的写法 
select * from user 
有字段a,b,c,要求优先满足 a>b and c=false 的数据排在前面,剩余的排在后面

解决方案 »

  1.   

    本帖最后由 libin_ftsafe 于 2008-01-23 15:08:37 编辑
      

  2.   

    select * from [user] order by case when a>b and c=false then 1 else 0 end
      

  3.   

    select * from [user] order by case when a>b and c=false then 1 else 0 end desc
      

  4.   

    select   *   from   [user]  
    order by case when a> b   and   c='false' then 0 else 1 end
      

  5.   

    请教一条sql语句的写法   
    select   *   from   user   
    有字段a,b,c,要求优先满足   a> b   and   c=false   的数据排在前面,剩余的排在后面---
    select * from [user] order by (case when a> b and c=false then 1 else 0  end) 接分了
      

  6.   


    SELECT *
    FROM user
    ORDERY BY CASE WHEN a > b and c = 'false' THEN 0 ELSE 1 END