case when的使用

https://www.php.cn/sql/442968.html

https://blog.csdn.net/qq_45061258/article/details/122033583

 

 

CASE sex
WHEN ‘1’ THEN ‘男’
WHEN ‘0’ THEN ‘女’
ELSE ‘其他’ END

 

 

CASE WHEN sex = ‘1’ THEN ‘男’
WHEN sex = ‘0’ THEN ‘女’
ELSE ‘其他’ END

 

 

select 
CASE status
WHEN 1 THEN '男'
WHEN 0 THEN '女'
ELSE '其他' END
from 
xx_user

 

posted @ 2022-08-04 18:23  凯宾斯基  阅读(27)  评论(0)    收藏  举报