WITH tmp AS (
select max(autoScore) score,z.courseID
from QZ_MEMBER_PAPER_SCORE as z where z.userID=1 and z.isExam != 0
group by z.courseID
)
SELECT b.*
FROM tmp a JOIN QZ_MEMBER_PAPER_SCORE b ON a.score=b.autoScore AND a.courseID=b.courseID
select max(autoScore) score,z.courseID
from QZ_MEMBER_PAPER_SCORE as z where z.userID=1 and z.isExam != 0
group by z.courseID
)
SELECT b.*
FROM tmp a JOIN QZ_MEMBER_PAPER_SCORE b ON a.score=b.autoScore AND a.courseID=b.courseID