2020-07-09
mysql批量update的问题
UPDATE mytable #更新 mytable 这个表
SET myfield = CASE other_field #更新 myfiled 字段 当 字段是 other_field时
WHEN 1 THEN '111' #当 other_field 等于1是 把 myfield 字段更新为111
WHEN 2 THEN '222' #当 other_field 等于2是 把 myfield 字段更新为222
WHEN 3 THEN '333' #当 other_field 等于3是 把 myfield 字段更新为333
END
WHERE id IN (1,2,3)
复制
这是我在网上看到的语句但是我试了下 无法使用啊
注释是我的理解
有大佬能帮我看看么
我来答
添加附件
收藏
分享
问题补充
2条回答
默认
最新
回答交流
Markdown
请输入正文
提交