-2
我使用的是PHP和MySQL,我有兩個表,其中包含字段number
和name
。 Table1中的name
字段默認爲空,並且table2中有一行的匹配數字我想更新table1中的名稱。如何從兩個表中選擇和更新
下面的僞代碼說明了這一點:
select number, number
from table1, table2
if number from table1 == number from table2
then insert or update name from table1 with the value of name from table2
你的問題不清楚! – Asteriskiiii 2013-02-27 08:24:58
這個問題還不夠清楚,我不能給你一個確切的答案。但我認爲你正在尋找http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html – JodyT 2013-02-27 09:26:23
請訪問這個[鏈接](http://www.4shared.com/ rar/MAJT3jqR/table.html)我更清晰的問題以及表結構和圖像 – batman 2013-02-28 06:20:16