phpmysqlsqlinsert-into

How to update tables with duplicate keys in sql?


How can I update a table that accept duplicate keys in SQL?

I was using Insert Into on Duplicate Key, but for a new requirement I need rows with duplicate keys.

How do I achieve the same behavior that Insert Into on Duplicate Key statement.

Thanks


Solution

  • You should never have duplicate keys. It is against the structure of a relational database. If you need to do something like this, then you need to redesign your database or add a new table with the data you want to duplicate but apply it to many that hold unique data.