[SQL]数据分析常用SQL中case when用法

常用的有两种方法:

1、简单Case函数 :

格式说明    

    case 列名

    when   条件值1   then  选项1

    when   条件值2    then  选项2.......

    else     默认值      end

2、Case搜索函数

格式说明    

    case  

    when  列名= 条件值1   then  选项1

扫描二维码关注公众号,回复: 2394668 查看本文章

    when  列名=条件值2    then  选项2.......

    else    默认值 end

猜你喜欢

转载自blog.csdn.net/tomocat/article/details/81189375