IFNULL( t6.vod_alias_name, t7.vod_name ) AS vodName,
t1.paper_name
FROM
class_dict t3
LEFT JOIN paper_dict t1 ON t3.course_id = t1.course_id
LEFT JOIN course_content t5 ON t3.course_id = t5.course_id
LEFT JOIN content_vod_mapping t6 ON t5.id = t6.content_id
AND t1.vod_id = t6.vod_id
left join vod_dict t7 on t1.vod_id = t7.id
WHERE
t1.delete_date IS NULL
AND t3.delete_date IS NULL
AND t3.id = #{classId}
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
AND t6.id IS NOT NULL
) t1
LEFT JOIN (
SELECT
c.paper_id,
c.member_id,
c.start_date,
c.create_date,
c.score,
c.result
FROM
exercise_done_result c
INNER JOIN (
SELECT
max( id ) id1,
a.paper_id
FROM
exercise_done_result a
INNER JOIN ( SELECT paper_id, member_id, max( score ) AS score FROM exercise_done_result WHERE class_id = #{classId} AND member_id = #{memberId} GROUP BY paper_id, member_id ) b ON a.paper_id = b.paper_id