There is always the simple way of joining to a lookup table with all of the possible values, and then search where the value appears in the lookup table, and not in your source table.
However, a quick google found this blog post, that has some great examples, and a fairly complete analysis of the different alternatives.
How to find missing values in a sequence with SQL
1 comment:
This is one of the more elegant pieces of code I've encountered recently.
Post a Comment