SQL如何实现批量更新

批量update  mybatis

//此处应该是<foreach>展开值 ...

update mydata_table set status = case when id = #{item.id} then #{item.status} end where id in (...);

例如:

update  TableName  set total =

case

when id = 1  then total + 120   

when id = 2  then total + 130

else total

end   

where id in (1,2)

猜你喜欢

转载自blog.csdn.net/printsky/article/details/81462137