| Author |
Topic  |
|
|
danielhieb
Starting Member
USA
2 Posts |
Posted - 02/12/2013 : 19:21:27
|
SELECT DISTINCT Type, Version, COUNT(*) FROM STOVE GROUP BY TYPE, VERSION;
Does Count(*) count just the selected columns(i.e. type, version)? If so, does it always count just the selected columns? |
Edited by - danielhieb on 02/12/2013 19:22:09
|
|
|
jimf
Flowing Fount of Yak Knowledge
USA
2865 Posts |
Posted - 02/12/2013 : 20:34:10
|
It counts all the rows in the group TYPE, VERSION. In your example, you don't even need the DISTINCT. If you want to count the distinct things in the group TYPE,VERSION, you can do something like
SELECT TYPE,VERSION, COUNT(DISTINCT InterestingColumn) FROM STOVE GROUP BY TYPE, VERSION;
If you want to know just how many different TYPE,VERSION combos you have, you can just do
SELECT Type, Version FROM STOVE GROUP BY TYPE, VERSION;
and see how many records there are, or do
SELECT COUNT(*) * FROM (
SELECT Type, Version FROM STOVE GROUP BY TYPE, VERSION ) t1
Jim
Everyday I learn something that somebody else already knew |
 |
|
|
danielhieb
Starting Member
USA
2 Posts |
Posted - 02/12/2013 : 20:39:27
|
Thanks!
Daniel Hieb |
 |
|
| |
Topic  |
|
|
|