Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Well123
Starting Member
3 Posts |
Posted - 2007-07-16 : 07:59:36
|
Hello all,Answer please: what's difference between COUNT(expression) and COUNT(ALL expression) aggregate functions?Thanks a lot |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-16 : 08:05:05
|
and books online = sql server help isn't clear enough?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
Well123
Starting Member
3 Posts |
Posted - 2007-07-16 : 08:14:50
|
[quote]Originally posted by spirit1 and books online = sql server help isn't clear enough?no, it isn't. I know, that ALL is default argument, but this answer isn't right for my teacher. |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-16 : 08:29:01
|
ALL = Applies the aggregate function to all values. ALL is the default.USE master;SELECT COUNT(name), COUNT(ALL name), COUNT(DISTINCT NAME), COUNT(*)FROM spt_values-- results-- 298 298 290 2346In microsoft sql server COUNT(name) and COUNT(ALL name) are the same thing_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
Well123
Starting Member
3 Posts |
Posted - 2007-07-16 : 08:45:49
|
quote: Originally posted by spirit1 ALL = Applies the aggregate function to all values. ALL is the default.USE master;SELECT COUNT(name), COUNT(ALL name), COUNT(DISTINCT NAME), COUNT(*)FROM spt_values-- results-- 298 298 290 2346In microsoft sql server COUNT(name) and COUNT(ALL name) are the same thing_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp
Thank you, for answer! |
 |
|
|
|
|