UPDATE table1
SET description = 'New description'
WHERE language_code = 'en' AND table2 default_category_id = '11'
如何正確使用table1和table2。我只能在使用table1時解決這個問題。MySQL更新字段與兩個表中的WHERE
UPDATE table1
SET description = 'New description'
WHERE language_code = 'en' AND table2 default_category_id = '11'
如何正確使用table1和table2。我只能在使用table1時解決這個問題。MySQL更新字段與兩個表中的WHERE
您需要在表格之間建立關係。
update table1
set description = 'New desc'
where language_code = 'en'
and some_column in (select related_column
from table2
where default_category_id = '11')
嘗試使用2臺
update table1 t1 join table2 t2 on t1.key = t2.key
set t1.desired_column = "value"
where t2.desired_column = "value"
可以共享表的結構和一些樣本數據之間的連接,以使這個問題更容易理解? – Mureinik