select COUNT(*) AS total_pv, COUNT(submit_time) AS complete_pv,
COUNT(DISTINCT CASE WHEN submit_time IS NOT NULL THEN exam_id END) AS complete_exam_cnt
FROM exam_record
用if
select COUNT(*) AS total_pv, COUNT(submit_time) AS complete_pv,
COUNT(DISTINCT if(submit_time IS NOT NULL,exam_id,NULL)) AS complete_exam_cnt
FROM exam_record