LEFT JOIN class_member_mapping cm ON cm.member_id = m.id
LEFT JOIN ( SELECT member_id, count( 1 ) AS ts, class_id FROM exercise_done_result WHERE score >= 60 GROUP BY class_id ) AS r ON r.member_id = m.id AND r.class_id = cm.class_id
LEFT JOIN ( SELECT member_id, count( 1 ) AS ts, class_id FROM exercise_done_result WHERE score >= 60 GROUP BY class_id,member_id ) AS r ON r.member_id = m.id AND r.class_id = cm.class_id
<!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id-->
<!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t2.delete_date IS NULL-->
<!-- AND t3.delete_date IS NULL-->
<!-- AND t.id = #{classId}-->
<!-- ) t3 ON t.class_id = t3.id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- sum(-->
<!-- IF-->
<!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- t2.member_id,-->
<!-- sum( t2.cnt ) AS cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- IF-->
<!-- ( max( t.score )>= 60, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- exercise_done_result t-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id-->
<!-- ) t2-->
<!-- GROUP BY-->
<!-- t2.class_id,-->
<!-- t2.member_id-->
<!-- ) t2-->
<!-- LEFT JOIN class_dict t3 ON t2.class_id = t3.id-->
<!-- LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id-->
<!-- ) t4 ON t.class_id = t4.class_id-->
<!-- LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id-->
<!-- LEFT JOIN course_content t2 ON t.course_id = t2.course_id-->
<!-- LEFT JOIN vod_dict t3 ON t2.id = t3.content_id-->
<!-- WHERE-->
<!-- t.delete_date IS NULL-->
<!-- AND t2.delete_date IS NULL-->
<!-- AND t3.delete_date IS NULL-->
<!-- AND t.id = #{classId}-->
<!-- ) t3 ON t.class_id = t3.id-->
<!-- LEFT JOIN (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- sum(-->
<!-- IF-->
<!-- ( t2.cnt >= t4.paper_cnt, 1, 0 )) AS pass_cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t2.class_id,-->
<!-- t2.member_id,-->
<!-- sum( t2.cnt ) AS cnt-->
<!-- FROM-->
<!-- (-->
<!-- SELECT-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id,-->
<!-- IF-->
<!-- ( max( t.score )>= 60, 1, 0 ) AS cnt-->
<!-- FROM-->
<!-- exercise_done_result t-->
<!-- WHERE-->
<!-- t.class_id = #{classId}-->
<!-- AND t.delete_date IS NULL-->
<!-- GROUP BY-->
<!-- t.paper_id,-->
<!-- t.class_id,-->
<!-- t.member_id-->
<!-- ) t2-->
<!-- GROUP BY-->
<!-- t2.class_id,-->
<!-- t2.member_id-->
<!-- ) t2-->
<!-- LEFT JOIN class_dict t3 ON t2.class_id = t3.id-->
<!-- LEFT JOIN ( SELECT t.course_id, count( 1 ) AS paper_cnt FROM paper_dict t WHERE t.delete_date IS NULL GROUP BY t.course_id ) t4 ON t3.course_id = t4.course_id-->
<!-- ) t4 ON t.class_id = t4.class_id-->
<!-- LEFT JOIN ( SELECT t.class_id, sum( 1 ) AS ask_cnt FROM answering_question t WHERE t.class_id = #{classId} AND t.delete_date IS NULL ) t5 ON t.class_id = t5.class_id-->