Peter Larsson Blog

Patron Saint of Lost Yaks

Finding records in one table not present in another table II

In previous topic here http://weblogs.sqlteam.com/peterl/archive/2007/09/20/Finding-records-in-one-table-not-present-in-another-table.aspx Michael Valentine Jones suggested an alternative route to get all records from one table not found in another. Here are the results (including my suggestion with only MIN(t1) = 1 as MVJ2) Read more →

Finding group of records with a certain status II

I got some response from same topic posted on September 20 http://weblogs.sqlteam.com/peterl/archive/2007/09/24/Finding-group-of-records-with-a-certain-status.aspx Hugo Kornelis posted an alternative code to my improvement and I promised to test it. Here is the new results (made on other machines so the absolute numbers do not match). Read more →

Finding records in one table not present in another table

Difference between NOT IN, LEFT JOIN and NOT EXISTS. The objective is to fetch all records in one table that are not present in another table. The most common code I’ve seen at client sites includes the use of NOT IN, because this keyword is included in most programming languages and programmers tend to use this technique when writing stored procedures in the database too. Read more →