Richard mentioned this article to me yesterday, and was surprised at what it told him. To summarize:SELECT COUNT() has 2 meanings:
Count the number of rows
Count the number of values
Sometimes these are the same thing, but not always. SELECT COUNT(*) always counts the number of rows in the resultSELECT COUNT(colname) counts the number of times that the column colname is not nullSo, if colname is always populated the result will be the same but otherwise the value will be different.
comments powered by Disqus