Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个student包含 3 个字段的表name:number和result。result字段包含Pass或Fail。我的问题是如何计算使用单个查询的数量pass和数量?fail
student
name
number
result
Pass
Fail
pass
fail
select t.result, count(1) from mytable t group by t.result ;
尝试
SELECT result, count(result) FROM student GROUP BY result;