赞
踩
方法一:
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,
注意: 无论是单独使用还是结合聚合函数 sum/count(distinct)/count/max/min使用,都要写end, else条件可有可无
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。