- case 字段 when 值1 then 替代值2 when 值2 then 替代值2 end as 字段
eg。 select a.*,b.user_nm,Case a.status WHEN 1 THEN '可用' ELSE '不可用' END as status1, case a.cls_typno when 1 then '货物类型' when 2 then '设备类型' when 3 then '货架类型 ' when 4 then '仓库区域' when 5 then '单位' when 6 then '报警类型' end as TypeName from m_ClassInfo a left outer join m_users b on a.upduser=b.user_no - 关键词 distinct用于返回唯一不同的值。(出掉重复)
eg。select distinct name from A