SQL如何用一条语句批量修改表中不同数据

使用一条语句批量修改数据,使用where和case when:

update tblUpdate

set Col2 = (case when Id = 1 then '第三次修改5' 

                           when Id = 2 then '第三次修改5'

                            else '第三次修改5'

                   end

                  )

where Id = 1 or Id = 2;

猜你喜欢

转载自www.cnblogs.com/ljx111/p/12613118.html