I have a table with the following schema :
+---------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | system_one_id | int(11) | NO | MUL | NULL | | | system_two_id | int(11) | NO | MUL | NULL | | | type | smallint(6) | NO | | NULL | | +---------------+-------------+------+-----+---------+----------------+ I want to delete duplicates, where "duplicate" is defined as either:
- matching values for both
system_one_idandsystem_two_idbetween two rows, or - "cross matched" values, ie
row1.system_one_id = row2.system_two_idandrow1.system_two_id = row2.system_one_id
Is there a way to delete both kinds of duplicates in one query?