Apologies if this question has already been asked, but i'm pulling my hair out!
I have two tables, abbreviated to KI and UG. KI contains a list of people and their photos, UG contains another list of people. What I want to do is match the tables up and return a query that shows me a list of names where we have a match between KI & UG. Now i'm halfway there, i've got my query and it works fine (almost) - the problem is that there are loads of duplicates in the list. The people that originally managed the KI table had input different images for the same person, leaving there to be multiple rows for "John Smith" for example.
This is my code:
SELECT ki.name, ug.name, ki.image_file
FROM kantechimages AS ki
INNER JOIN user_group as UG ON ki.name like ug.name
WHERE ki.image_file is not null
GROUP BY ki.name, ug.name, ki.image_file
So my question is, how can I remove the duplicate names from the list and only return one row where we have a match instead of all of them?
Many thanks!