select 查询中 用于根据不同条件输出不同的内容
-- 一种是:
case 字段
when 取值 then 输出的内容
when 取值 then 输出的内容
。。。
else 保底的输出 [字段别名]
-- 另一种是:
case
when 条件 then 输出的内容
when 条件 then 输出的内容
。。。
else 保底的输出 [字段别名]
使用举例:
select 查询中 用于根据不同条件输出不同的内容
-- 一种是:
case 字段
when 取值 then 输出的内容
when 取值 then 输出的内容
。。。
else 保底的输出 [字段别名]
-- 另一种是:
case
when 条件 then 输出的内容
when 条件 then 输出的内容
。。。
else 保底的输出 [字段别名]
使用举例: