案例一:统计任务完成和未完成的数量
SELECT
CASE
WC WHEN '0' THEN '完成' ELSE '未完成' END AS name,
COUNT( ID ) AS value
FROM
l_rwgl_rwjl
WHERE
is_deleted = 0
AND WC IS NOT NULL
GROUP BY
WC
image.png
案例二:按照任务地点统计任务完成和未完成的情况
SELECT
rwdd 'missionPlace',
ifnull( SUM( CASE WHEN WC = 0 THEN 1 ELSE 0 END ), 0 ) 'finished',
ifnull( SUM( CASE WHEN WC = 1 THEN 1 ELSE 0 END ), 0 ) 'unFinished'
FROM
l_rwgl_rwjl
WHERE
is_deleted = 0
AND rwdd IN ( SELECT rwdd FROM l_rwgl_rwjl )
GROUP BY
RWDD
image.png
持续更新...
网友评论