开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜