remove duplicates from sql union
Union
will remove duplicates. Union All
does not.
Using UNION
automatically removes duplicate rows unless you specify UNION ALL
:
http://msdn.microsoft.com/en-us/library/ms180026(SQL.90).aspx
Others have already answered your direct question, but perhaps you could simplify the query to eliminate the question (or have I missed something, and a query like the following will really produce substantially different results?):
select *
from calls c join users u
on c.assigned_to = u.user_id
or c.requestor_id = u.user_id
where u.dept = 4