Distinct + Count
-
I want to find distinct country and count of each country from a country table. How should I do? Result: Country | Count Japan | 10 UK | 8 Canada | 12
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****
-
I want to find distinct country and count of each country from a country table. How should I do? Result: Country | Count Japan | 10 UK | 8 Canada | 12
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****
-
select country, count(country) from countrytable group by country
// ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫
-
select country, count(country) from countrytable group by country
// ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫
-
Is is not working for null country and does not give correct count Hepl ?
***** Programme comme si dept soutien technique. est plein de tueurs en série et ils savent adresse de votre domicile. *****
Use
isnull
for your count field. e.gselect country, count(isnull(country,0)) from countrytable
group by country
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
-
Use
isnull
for your count field. e.gselect country, count(isnull(country,0)) from countrytable
group by country
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com