I have a table say incompatible
which has two columns namely codeA
and codeB
. Now, I have two entries as A, B
and B, A
if A is incompatible to B. My question is how do I remove one of the rows from the table in mysql?
Try this:
DELETE t1 FROM incompatible AS t1
INNER JOIN incompatible AS t2 ON t1.codeA = t2.codeB AND t2.codeB = t1.codeA
WHERE t1.codeA > t1.codeB