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.
我的表中有“结果”列。结果列包含以下三个值之一:通过、失败、未完成。我需要编写一个查询,它给出以下三个结果 1. 通过记录的总数 2. 失败记录的总数 3. 不完整记录的总数
是否可以?如果是,请指导我写。提前致谢。
SELECT COUNT(CASE result WHEN 'Pass' THEN 1 END) AS passed, COUNT(CASE result WHEN 'Failed' THEN 1 END) AS failed, COUNT(CASE result WHEN 'Incomplete' THEN 1 END) AS incomplete FROM mytable