总结一下:两种表达方式是等效的
方法一:
case
when tb1.os = 'android' then 'android'
when tb1.os = 'ios' then 'iPhone'
else 'PC'
end as os,
方法二:
case tb1.os
when 'android' then 'android'
when 'ios' then 'iPhone'
else 'PC'
end as os,
本文介绍了 SQL 中 case 语句的两种等效使用方式,并通过实例展示了如何根据不同操作系统名称转换为统一的显示文本。
总结一下:两种表达方式是等效的
方法一:
case
when tb1.os = 'android' then 'android'
when tb1.os = 'ios' then 'iPhone'
else 'PC'
end as os,
方法二:
case tb1.os
when 'android' then 'android'
when 'ios' then 'iPhone'
else 'PC'
end as os,