0
我將數據插入到表如下:如何在mySQL中替換數據時忽略錯誤?
REPLACE INTO `test`(`id`,`text`) VALUES (1,'first'), (2, 'second'), (3, 'third')
但是,如果數據集的一個不正確,則所有其他組不屬於表。
REPLACE INTO `test`(`id`,`text`) VALUES (1,'new first'), (2, NULL), (3, 'new third')
如何實現以下目標: 第一和第三組數據是替換表中現有的數據。第二個要被忽略,表中的數據不應該改變。
RTFM:http://dev.mysql.com/doc/refman/5.7/en/update.html,http://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate .html – Alex
你不應該忽略錯誤 – Wistar