Home  >  Q&A  >  body text

mysql如何update含有联合唯一索引的列

一个表的数据需要定期批量插入,于是对几个字段做了联合索引unique.
现在有需求偶尔更新某条数据,但会产生:
1062, "Duplicate entry 'oWuCHjmbxK7cvY4AaNy89l1dVrt8-oLU1vwjBUwy5-qDPGZU5CtcHv_ts-88-gh_' for key 'index2'")
的错误,请问怎么更新呢?

黄舟黄舟2742 days ago646

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-04-17 13:30:41

    Since the index you want to update has encountered duplication and you want to update it again, the only way is to remove the index. What else can you do

    reply
    0
  • Cancelreply