Updating a joined table PHP MySQL
In MySQL I know its possible to select from two tables that have been joined, but is it possi开发者_如何学Cble to update the same two tables using a join? Or will I have to update each table individually?
Yes, e.g.
UPDATE table1 t1
JOIN table2 t2
ON t2.id = t1.id -- Your keys.
SET t1.column = '...', t2.column = '...' -- Your Updates
WHERE ... -- Your conditional
精彩评论