Forum Moderators: open
I have a MySQL table with fields including Telephone and Email.
I want to do a query that will return all unqiue records where if there are 2+ plus records that have the same telephone (or the same email, or the same email + telephone) only one of the records will be returned (doesn't matter which one).
I can't use DISTINCT as I need to return other fields too.
I tried using GROUP BY (GROUP BY telephone, email) however this seems to be looking at both fields combined and comparing them - hence its still returning records that have the same telephone (e.g. the same telephone but different email - not what I'm looking for).
Can anyone suggest the correct query to use? Thanks