SQL语句 case ... when

select 字段A, 字段B,

CASE
WHEN t.operate = 1 then 'aa'
WHEN t.operate = 2 then 'bb'
WHEN t.operate = 3 then 'cc'
WHEN t.operate = 4 then 'dd'
WHEN t.operate = 5 then 'ee'
WHEN t.operate = 6 then 'ff'
END
as '字段C'

from t_table

天津雍博科技有限责任公司

www.yongbosoft.com

原文地址:https://www.cnblogs.com/monjeo/p/10833382.html