I have a table with name, contact1, contact2 and contact3 columns. Is there a way to find out of a given number exists in either of the 3 contact columns?
I am looking identify if a number exists more than once across contact1, contact2 and contact3 columns.
Please help.
Best Answer
You want a query like this one:
See the db-fiddle here (see DDL and DML below).
Result:
Of course, if MySQL had
CHECK CONSTRAINT
s, this problem could be avoided at the DDL level! From here, you have this gem:============= DDL and DML ============