UPDATE goods SET nums= CASE id WHEN 1 THEN 0.27 WHEN 2 THEN 22.53 WHEN 3 THEN 0.27 END, num= CASE id WHEN 1 THEN 15 WHEN 2 THEN 475 WHEN 3 THEN 15 END WHERE id IN (1,2,3)
注解:此语句更新两个字段 nums 、num
case 后面字段为条件字段,如上:当 id=1时,那么 nums=0.27,id=2时,那么 nums=22.53;
when后面为条件值,then后为修改的取值,end为结束此判断