MYSQL UNION DISTINCT

No. You cannot specify which exact field you need to distinct with. It only works with the whole row. As of your problem – just make your query a subquery and in outer one GROUP BY user_id SELECT * FROM (SELECT a.user_id,a.updatecontents as city,b.country FROM userprofiletemp AS a LEFT JOIN userattributes AS b ON a.user_id=b.user_id … Read more