题解 | #统计作答次数#
统计作答次数
https://www.nowcoder.com/practice/45a87639110841b6950ef6a12d20175f
select count(1) as total_pv, sum( case when a.submit_time is not null and a.score is not null then 1 else 0 end ) as complete_pv, count( distinct case when a.submit_time is not null and a.score is not null then a.exam_id else null end ) as complete_exam_cnt from exam_record a
你爱用if用if哈,我是不怎么喜欢if。因为以前遇到过很多复杂条件,if用着是真难受。