remove duplicates from sql union

后端 未结 6 580
北恋
北恋 2020-12-29 01:45

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
         


        
6条回答
  •  渐次进展
    2020-12-29 02:22

    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
    

提交回复
热议问题