SELECT COUNT( DISTINCT `student_id` )
FROM a
WHERE `marks` >=90
以上给了我分数大于 90 的学生数,
COUNT( DISTINCT `student_id` )
4
现在我想要两个答案,一个分数 > 90 另一个 > 80
像这样的东西
COUNT( DISTINCT `student_id` ) |COUNT( DISTINCT `student_id` )
4 5
这是我在谷歌搜索后尝试过的
select
count_1 =( SELECT COUNT( DISTINCT `student_id` )
FROM a
WHERE `marks` >=90),
count_2 =( SELECT COUNT( DISTINCT `student_id` )
FROM a
WHERE `marks` >=80)