The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

    • RT @SethAbramson: MAJOR BREAKING NEWS: Kanye West Presidential Bid Revealed As Highly Coordinated Republican Operation to Suppress Black Vo… 33 minutes ago
    • RT @robinhouston: This is … It was easier to RENAME ALL THE GENES than to persuade biologists to use software that doesn’t mangle gene nam… 33 minutes ago
    • RT @parool: Scholen moeten dringend de ventilatie verbeteren voordat het winter wordt en de ramen niet meer open kunnen. Dat stellen deskun… 34 minutes ago
    • RT @arjenUSA: New York neemt rigoreuze stap. Bij bruggen en tunnels worden checkpoints opgesteld om ervoor te zorgen dat bezoekers uit 35 s… 35 minutes ago
    • RT @JenkinsJacky: Why is anyone surprised at this? Many of us have been screaming this from the roof-tops (as the low flying virus monsters… 35 minutes ago
  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,042 other followers

sql – How to Select Every Row Where Column Value is NOT Distinct – Stack Overflow

Posted by jpluimers on 2019/05/22

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)


select emailaddress,customername from Customers a where exists
(select emailaddress from customers c where a.customerName != c.customerName and a.EmailAddress = c.EmailAddress)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: