美文网首页
update关联更新两个表

update关联更新两个表

作者: 晓函 | 来源:发表于2022-01-06 15:20 被阅读0次
update test1,test2 
set test1.name=test2.name,test1.age=test2.age
where test1.id=test2.id

实际操作:
在thing里面添加order_id字段

update thing,order 
set thing.order_id=order.id 
where thing.status=3 and thing.id=order.thing_id

相关文章

网友评论

      本文标题:update关联更新两个表

      本文链接:https://www.haomeiwen.com/subject/aqcrcrtx.html