gpt4 book ai didi

MySql 计算相同的值

转载 作者:太空宇宙 更新时间:2023-11-03 12:17:58 25 4
gpt4 key购买 nike

我有这张 table 。我的任务是:计算名字相同的学生。

我希望它只显示名字,然后显示名字被找到的次数:

像这样: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 计算相同的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21277696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com