Since I always forget that IN
and EXISTS
have very different performance characteristics: [WayBack] sql – How to Select Every Row Where Column Value is NOT Distinct – Stack Overflow
Less slow
select emailaddress,customername from customers where emailaddress in
(select emailaddress from customers group by emailaddress having count(*) > 1)
Slow
select emailaddress,customername from Customers a where exists
(select emailaddress from customers c where a.customerName != c.customerName and a.EmailAddress = c.EmailAddress)
–jeroen