Press "Enter" to skip to content

COUNT And NULL

Bert Wagner explains some of the trickiness of COUNT and NULL values in SQL Server:

One thing I see fairly often (and am occasionally guilty of myself) is using COUNT(DISTINCT) and DISTINCT interchangeably to get an idea of the number of unique values in a column.

While they will sometimes give you the same results, depending on the data the two methods may not always be interchangeable.

Click through for examples.