MySQL从查询结果中更新数据

 通过查询备份表把符合条件的数据更新到主表中。

UPDATE resource_bill
INNER JOIN (SELECT id, destory_at FROM resource_bill_backup) b ON b.id=resource_bill.id
SET resource_bill.destory_at = b.destory_at 
WHERE resource_bill.destory_at=STR_TO_DATE('2023-07-04','%Y-%m-%d')

猜你喜欢

转载自blog.csdn.net/xhaimail/article/details/131844708
今日推荐