我有这张桌子。我的任务是:计算具有相同名字的学生。
我希望它仅显示名字,然后显示名字多少次:
像这样:bob | 2
id firstN lastN group grade tax gender year university
9 Alyson Hanniga 112 1 0 female 1 UTC
5 Barney Stinson 111 4 0 male 1 UBB
8 Bob Saget 111 6 900 male 3 UBB
14 Bob Bob 112 10 250 male 1 UBB
11 Cobie Smulder 111 9 200 female 1 Dragos Voda
7 David Henrie 112 9 0 male 1 Dragos Voda
12 Jason Segel 112 10 150 male 1 UTC
13 Josh Radnor 112 7 0 male 2 Dragos Voda
4 Lily Aldrin 112 5 400 female 1 UBB
6 Lyndsy Fonseca 113 10 0 female 3 UTC
2 Marshal Eriksen 112 10 100 male 2 UTC
10 Neil Patrick 112 7 0 male 3 Dragos Voda
1 Robin Scherba 111 10 0 female 1 UBB
3 Ted Mosby 112 8 0 male 2 UBB
最佳答案
这是查询
select FirstName,count(*) from tblStudent group by FirstName
关于mysql - MySql计数相同的值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21277696/