Mysql的switch语句


select case status when 1 then '成功' when 2 then '失败' else '其他' end from user

 

  • case后面紧跟要被作为判断的字段
  • when后面跟判断条件
  • then后面跟结果
  • else相当于default
  • end是语句结束语

 

来源:https://blog.csdn.net/u012150370/article/details/50505408

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM