我需要让查询计算记录数,并将计数放在它所代表的记录旁边。例如:
Turkey
France
Turkey
United States
Italy
Italy
Turkey
France
United States
France
Italy
Italy
变成:
Country NumberOfVisits
Turkey 4
France 3
United States 2
Italy 4
我似乎无法让这些国家在这篇文章中以自己的方式展示
答案 0 :(得分:3)
您需要在SQL语句中使用Group By
,例如:
SELECT Country, Count(*) as NumberOfVisits FROM CountryTable GROUP BY Country