mysql count 搭配case的使用,一条sql统计多条数据
程序员文章站
2022-03-06 16:09:51
...
SELECT
count(CASE WHEN testresult IS NULL THEN 1 end)'NULL',
count(CASE WHEN testresult ='FAIL' THEN 1 end)'FAIL',
count(CASE WHEN testresult = 'PASS' THEN 1 end)'PASS'
FROM auto_jdy_uidesc
WHERE Uitest_id IN
(SELECT a.id from auto_jdy_taskdesc a WHERE a.taskname ="login")