select 姓名,case when charindex('您好',备注)>0 then '*' else '' end as 备注 order by 备注
我想让所有带*排在一起,order by 语句怎么写?

解决方案 »

  1.   

    select 姓名
    FROM 
    table1
    ORDER BY 
    case when charindex('您好',备注)>0 then '*' else '' end,备注
      

  2.   

    select 姓名,case when charindex('您好',备注)>0 then '*' else '' end as 备注 order by 2
      

  3.   

    select 姓名
    FROM 
    table1
    ORDER BY 
    case when charindex('您好',备注)>0 then 1 else 2 end,备注
      

  4.   

    select 姓名,case when charindex('您好',备注)>0 then '*' else '' end as 备注 order by 2
      

  5.   


    order by 2 //按筛选的第二列排序参考:http://topic.csdn.net/t/20061212/17/5225505.html
    学习!!
      

  6.   


    select 姓名,case when charindex('您好',备注)>0 then '*' else '' end as 备注 order by 
    case when charindex('您好',备注)>0 then 0 else 1 end
      

  7.   

    vfp9.0:
    sele 姓名, 备注 from tt where 备注 like %"您好"% into table mytt
    update mytt set 备注='*'由于不清楚charindex()?可能不符合楼主的意思。
      

  8.   


    select 姓名, 备注 from tt where 备注 like %'您好'% into table mytt
    update mytt set 备注='*'