我有以下信息
Game_id | Team
47 | 1
47 | 1
23 | 2
31 | 1
41 | 2
47 | 8
我想计算所有比赛中的每队数。
我希望它是这样的:
Team 1 has made 3 goals
Team 2 has made 2 goals
Team 8 made 1 goal.
我该怎么做?
答案 0 :(得分:2)
使用COUNT()
和GROUP BY
,例如:
SELECT Team, COUNT(Team) FROM myTable GROUP BY Team