MySQL cleanup table from duplicated entries AND relink FK in depending table
问题 Here is my situation: I have 2 tables, patient and study . Each table has its own PK using autoincrement. In my case, the pat_id should be unique. It's not declared as unique at database level since it could be non unique is some uses (it's not a home made system). I found out how to configure the system to consider the pat_id as unique, but I need now to cleanup the database for duplicated patients AND relink duplicated patients in study table to remaining unique patient , before deleting