从 sql union 中删除重复项 [英] remove duplicates from sql union
本文介绍了从 sql union 中删除重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用联合(正确或错误)对我拥有的几个表执行一些基本的 sql
I'm doing some basic sql on a few tables I have, using a union(rightly or wrongly)
但我需要删除重复项.有什么想法吗?
but I need remove the duplicates. Any ideas?
select * from calls
left join users a on calls.assigned_to= a.user_id
where a.dept = 4
union
select * from calls
left join users r on calls.requestor_id= r.user_id
where r.dept = 4
推荐答案
Union
将删除重复项.Union All
没有.
Union
will remove duplicates. Union All
does not.
这篇关于从 sql union 中删除重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文