Mysql case when then else end用法

前言:该语法碰到大多用于数据库根据条件判断给字段赋值的情况
1.mysql数据库写法
Mysql case when then else end用法2.这样的语句不适用于开发,原因在于字段
Mysql case when then else end用法这里有个小坑,许多语法只是写字段,as后面的字段名不能和操作的字段名一致,否则报错
3.case 字段 when value then value when value then value else 字段 end as 新字段名 的用法
Mysql case when then else end用法value要对应字段类型