Sorry,开发者_如何学C this should be easy but slightly different with other questions. Would someone help me to combine the following commands into single mysql query?
UPDATE table1 SET mid='99' WHERE mid='4';
UPDATE table2 SET mid='99' WHERE mid='4';
Just use a join, and then update both columns in the combined result
UPDATE table1 LEFT JOIN table2 USING (mid) SET table1.mid = 99, table2.mid = 99 WHERE mid = 4;
You could try the following
UPDATE table1 AS t, table2 AS t2 SET t.mid = 99, t2.mid = 99 WHERE t.mid = 4 AND t2.mid = 4;
精彩评论