标签:
准备数据
表 user(用户)、dept(部门)
1:更新符合单个条件的某个字段的一条数据
update user u set u.name = ‘测试‘ where u.id = ""
2:in 更新多条数据
update user u set u.name = ‘测试‘ where u.id in ("", "", "")
3:符合多个条件更新内容不同的多个字段
update user u set u.address = case u.id when "a" then "是斯蒂芬斯蒂芬" when "b" then "第三方" else "" end where u.id in ("a", "b")
4:多表联合
update user u left join dept d on u.deptId = d.id set u.name = "", d.name = ""
标签:
原文地址:http://www.cnblogs.com/ajun/p/4843768.html