0
我想选择至少两个共享相同生日的学生的不同class_id的总数。MySql计算至少出现两次的行的总数
class_id student_id birthday
1 30 1994-10-01
1 23 1994-01-01
1 19 1994-02-01
1 11 1994-03-01
2 9 1994-02-01
2 43 1994-03-01
3 41 1994-06-01
3 21 1994-05-01
4 9 1992-05-22
4 20 1992-09-05
'count(birthday)'应该是'count(*)'。只有在使用“DISTINCT”时才需要输入列名,或者您需要使用它来跳过空值。 – Barmar
'count(class_id)'同样的东西'。只要摆脱使用'count(colname)'的习惯,它几乎不需要。 – Barmar