It seems your query returns are right, but they are not what you want. Here is the question for you, if you want only one record among the four ACE USA records, which column(s) should we use to remove other three.
You can use a ranking function to to get the top 1 row of each group, so your returning records will be unique.
SELECT group_descr, first_name, last_name, user_id, email, group_id FROM (SELECT d.group_descr, a.first_name, a.last_name, a.user_id, b.email, d.group_id, ROW_NUMBER() OVER(PARTITION BY d.group_id ORDER BY a.user_Id DESC) as rn
FROM icc_user_data AS a LEFT OUTER JOIN
icc_users AS b ON a.user_id = b.user_id LEFT OUTER JOIN
icc_users_groups AS c ON a.user_id = c.user_id LEFT OUTER JOIN
icc_groups AS d ON c.group_id = d.group_id
WHERE (b.user_id NOT IN (249)) AND (d.group_id IS NOT NULL)
ORDER BY d.group_descr
) t
WHERE rn=1
Limno
Format your SQL query with instant sql formatter:
http://www.dpriver.com/pp/sqlformat.htm