当数据量多的时候,使用select update 来执行操作
在sql中实现如下
将表t_reconciliation_record中的order_center_no 字段的值 更新到表 t_capital_detail中的order_code字段上
update t_capital_detail c left join t_reconciliation_record r
on c.batch_no=r.batch_no
and c.transaction_serial_no =r.org_order_no
set c.order_code=r.order_center_no
where c.batch_no=201812119007936432
查询结果
select * from t_capital_detail c left join t_reconciliation_record r on c.batch_no=r.batch_no
and c.transaction_serial_no =r.org_order_no where c.batch_no=201812119007936432
另一种方式为
UPDATE table1 a,table2 b
SET a.fee = b.fee
WHERE a.id = b.id
在mybatis中实现只需要将batch_no作为参数传入

本文介绍了一种在数据量巨大时,使用SQL语句进行高效批量更新的方法。通过左连接两个表,可以将一个表的字段值更新到另一个表的对应字段上。文中提供了具体的SQL语句示例,包括使用条件和参数传递的方式。
2万+

被折叠的 条评论
为什么被折叠?



