汇商网 科技与电子产品领域信息大全

sql的casewhen语句嵌套使用

SQL case when语句嵌套使用

1、简单的case when语句:

case sex when ’1' then '男' when ’2’ then '女’else ’其他’ end

2、复杂的case when语句:

case when month in (01,02,03) then '第一季度' when month in (04,05,06) then '第二季度' when month in (07,08,09) then '第三季度' when month in (10,11,12) then ‘第四季度’ end

版权说明:文章均为账号作者发布,不代表本网站观点与立场,如有侵权请联系我们删除