代理名称 | 位置 | qa_agent |
---|---|---|
第一的 | 致命的 | 行政 |
第二 | 非致命 | 行政 |
第二 | 非致命 | 行政 |
我需要这样的输出
代理名称 | qa代理数 | 计数致命计数 | 计数非致命 |
---|---|---|---|
第一的 | 1 | 1 | 0 |
第二 | 1 | 0 | 2 |
您可以尝试使用 conditional aggregation
select agent_name,
count(distinct qa_agent) as Count_qa_agent,
count(case when position='fatal' then 1 end) as Count_fatal,
count(case when position='non fatal' then 1 end) as Count_Non_fatal
from tablename
group by agent_name
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句