有3张表
table1,table2,table3
其中
t1存client_id,client_name,id_num
t2存client_id,client_name,id_num
t3存client_id,agreement_no,product_no
有如下现象
t1.client_name = t2.client_name,
t1_id_num = t2.id_num,
t1.client_id != t2.client_id,
t3有多条数据项,其中1条的client_id = t1.client_id,剩余的client_id = t2.client_id
如何编写sql将t3表中等于t1.client_id的数据修改成t2.client_id
示例:
table | client_id | client_name | id_num | agreement_no | product_no |
---|---|---|---|---|---|
t1 | 111 | 张三 | 666 | / | / |
t2 | 222 | 张三 | 666 | / | / |
t3 | 111 | / | / | 777 | 02 |
t3 | 222 | / | / | 888 | 03 |
t3 | 222 | / | / | 999 | 04 |