select * from 表 order by rq,
case when gx='aaaa' then mj end,
case when gx='aaaa' then hd end,
case when gx='aaaa' then ys end

解决方案 »

  1.   

    select * from t
    order by rq,case gx when 'aaaa'then mj desc,hd desc,ys desc end
      

  2.   

    select * from 表 order by rq,
    case gx when 'aaaa' then mj end desc,
    case gx when 'aaaa' then hd end desc,
    case gx when 'aaaa' then ys end desc
      

  3.   

    不好意思!说的有点不正确了。
    最后的那个印刷是按字段(gx)来排序的。to:pengdali(大力 V3.0) 
    mj字段是想要从大到小;
    hd字段是从厚到薄;
    gx字段是否有印刷这个值,有则排到前面,无则排到后面。
    你写的好像实现不了!!!
      

  4.   

    select * from 表 order by rq,
    case when gx='aaaa' then mj end desc,
    case when gx='aaaa' then hd end desc,
    case when gx='aaaa' then gx end不知道是不是这个意思.
      

  5.   

    首先谢谢各位!
    to:CrazyFor(冬眠的鼹鼠) 
    最后的那个条件只是按gx字段排序了。
    我想要的是把gx中值为ys的排到前面,其他的排在它的后面。
    你的好像实现不了!!!
      

  6.   

    楼主的意思一开始没有表达清楚,后面补充说明了建议你最好重新发一下                               
                 ====>Just Seeing  Hearing  Saying  Waitting  Loving<====