Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有办法覆盖或跳过重复记录?
有没有办法添加:插入重复键更新到只有插入的 sql 文件?
看看12.2.5.1。INSERT ... SELECT 语法和12.2.5。插入语法
并寻找
指定 IGNORE 以忽略会导致重复键违规的行。
试试这个:
INSERT ON DUPLICATE KEY UPDATE
尽管通常人们忘记为 id 设置自动增量字段,从而导致错误。