edawg Posted April 7, 2007 Share Posted April 7, 2007 Is it possilbe to update more than one table at a time using the same UPDATE command???, or do I have to use 2 seperate UPDATE queries?. Link to comment https://forums.phpfreaks.com/topic/46028-update-more-than-one-table-at-a-time/ Share on other sites More sharing options...
fenway Posted April 7, 2007 Share Posted April 7, 2007 Indeed, with v4.0+ -- check the refman for the syntax. Link to comment https://forums.phpfreaks.com/topic/46028-update-more-than-one-table-at-a-time/#findComment-223847 Share on other sites More sharing options...
gluck Posted April 10, 2007 Share Posted April 10, 2007 UPDATE [LOW_PRIORITY] [iGNORE] table_references SET col_name1=expr1 [, col_name2=expr2 ...] [WHERE where_condition] Link to comment https://forums.phpfreaks.com/topic/46028-update-more-than-one-table-at-a-time/#findComment-226375 Share on other sites More sharing options...
fenway Posted April 11, 2007 Share Posted April 11, 2007 This is more clear (from the refman as well): UPDATE items,month SET items.price=month.price WHERE items.id=month.id; The preceding example shows an inner join that uses the comma operator, but multiple-table UPDATE statements can use any type of join allowed in SELECT statements, such as LEFT JOIN. Link to comment https://forums.phpfreaks.com/topic/46028-update-more-than-one-table-at-a-time/#findComment-226695 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.