[英]Python - Fastest way to update multiple records in one table by selecting id from B table
I have two tables in MySQL, which named A and B. 我在MySQL中有两个表,分别命名为A和B。
I want to update B table u_id by selecting A table's u_id, with the condition a_id is equal to b_id. 我想通过选择条件为a_id等于b_id的A表的u_id来更新B表u_id。
For example, record in A looks like ('001', 'a00'),('003', 'a01'); 例如,A中的记录看起来像('001','a00'),('003','a01'); record in B looks like ('001', ''), ('002', ''), ('003', '')
B中的记录看起来像('001',''),('002',''),('003','')
I want to update B table records with the result ('001', 'a00'), ('003', 'a01') 我想用结果('001','a00'),('003','a01')更新B表记录
What is the fastest way to update the B table's u_id value? 更新B表的u_id值的最快方法是什么? Thanks you.
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.