嗨,大家好,我想更新兩個表中的列。例如:abc
和xyz
。 abc
表包含稱爲id
,fname
,lastname
,status
的字段。並且表xyz
包含id
,x_id
和status
。現在我想要的是通過使用單個查詢從abc
和status
列xyz
更新列狀態。如何更新mysql中多個表的列
我試着這個查詢,但它不工作。
UPDATE abc a1
JOIN xyz x1 ON a1.id = x1.x_id
SET a1.status = "D" ,
x1.status = "delete"
WHERE a1.id = 15 AND x1.x_id = 15;
謝謝。
檢查: http://stackoverflow.com/questions/4361774/mysql-update-multiple-tables-與一查詢 和 http://stackoverflow.com/questions/1871537/how-to-update-two-tables-in-one-statement – 2013-02-15 07:56:38
+1用於鏈接相關鏈接 – Khez 2013-02-15 07:58:40