tsql get count of group by field code example Example: sql groub by count SELECT COUNT(Id), Country FROM Customer GROUP BY Country