2011-01-19 111 views

回答

4

我認爲你正在尋找一個更新查詢:

UPDATE 
    table_name 
SET 
    column = 'value'; 

這樣只會將數據「插入」到一個列中,而其他所有數據都不會受到干擾。

如果你想從另一個表的結果進行更新,你也可以做加盟:

UPDATE 
    table_name 
    INNER JOIN source_table ON 
     table_name.some_id = source_table.some_id 
SET 
    table_name.column = source_table.column; 

希望有所幫助。您可能想嘗試使用更多信息來澄清問題。

2

如果你的意思是「插入」,如「更新」,然後

# to a fixed value 
update tbl set col = "abc" 
# WHERE <some condition> # optionally identify which record 

# add to existing value 
update tbl set col = concat(col, "abc") # add "abc" to the end of the current value 
# WHERE <some condition> # optionally identify which record 
相關問題