select name,(case when total>1000 then 'large' else 'small' end ) as type from test where name='zxhong'

解决方案 »

  1.   

    select name,(case when total>1000 then 'large' else 'small' end ) as type,total from test where name='zxhong'
    order by total desc
      

  2.   

    我觉得应该把查询和赋值分开处理
    先用  select * from test where name='zxhong'
    将数据取出
    然后通过判断 total 值对 type 赋值
    最后如果你要再查询并排序的话重新执行一次 select 就行了
      

  3.   

    enhydraboy(乱舞的浮尘) 的能实现你要的功能。
      

  4.   

    select *,case when total>1000 then type='large' else 'small' end type from test name='zxhong' order by total desc是吗?