【SQL學習筆記4】case when 和if的用法

1.case用法sql -- 用法一: case when 條件1 then 字段取值1 when 條件2 then 字段取值2 when 條件3 then 字段取值3 else 字段取值4-- 若是上述所有不知足,則執行 end -- 用法二: case 字段名 when 取值1 then 字段取值1 when 取值2 then 字段取值2 when 取值3 then 字段取值3 else 字
相關文章
相關標籤/搜索