The first time I wrote blog, it's a little tense, I think I am a small rookie, I am afraid to write something to let others 'jokes', just remember some problems that usually encounter, or you need to pay attention to small places.
The first case of the return value in the SQLServer statement: If there is no qualified record in the database, the result is 1 when the aggregate function is returned, the result is 1, and the return value is NULL.
The second case: If there is no conditional record in the database, the result is 0 when returning is a normal field.
Third case: If there is a compliant record (N) in the database, the result is N, which is N, return the corresponding value (possibly a normal value or null).