For example I have table that has such columns as geography and children. I need to count how many there are childrens from each country.
I only could make such thing:
SELECT geography, COUNT( * )
FROM table1
GROUP BY children
ORDER BY geography
Well, I have for example:
Canada John
Canada John
Canada Peter
I need result such as from Canada there are 2 children.
But If I will make group by children there result is:
Canada 2
Canada 1
If group by geography then,
Canada 3
If you need to count only the unique values in a group, you can use
COUNT(DISTINCT expr)