谁能告诉我如何更新具有相同值的多行..?
例如,如果我有一个员工表,例如,
employee id salary
1 100
2 230
3 120
4 360
5 190
如果我希望员工 1、2 和 5 的工资相同,比如 300... 如何使用单个查询更新它?
谢谢
最佳答案
update employee
set salary = 300
where [employee id] in (1,2,5)
或
update employee
set salary = 300
where [employee id] = 1
or [employee id] = 2
or [employee id] = 5
关于sql - MS SQL 如何用单个值更新多行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19180253/