Another way to do a not exists SQL query with best performance

This comes up again and again as a thorny and persistent problem. I got this new way of doing this from my friend.

SELECT alias1.PKCol1, alias1.Col2
FROM table1 alias1
WHERE alias1.Col3= 11 AND alias1.Col4= 43 AND
      NOT EXISTS (SELECT 'x' FROM table2 alias2 WHERE alias2.PKCol1 = alias1.PKCol1)

Comments

Popular posts from this blog

Tutorial: Using Google Cloud Storage from C# and .NET

Late 2008 Macbook only giving 1.5 gb/s speed with 6 gb/s Intel SSD?

The ridiculous interview experience