請參考以下SQL: select a.classcode, a.classno, a.enname, a.chname, (case when b.subjectcode=1 then 'Chi' when b.subjectcode=2 then 'Eng' when b.subjectcode=3 then 'Math' else null end) 'Subject', b.totalscore 'Score', d.engname 'Componant', c.sectionscore 'Comp Score' from vw_stu_lateststudent a join tb_hka_scores b on a.suid=b.suid and a.stuid=b.stuid and a.schyear=b.schyear and b.testlevel='S1A' left outer join tb_hka_sectionscores c on a.suid=c.suid and a.stuid=c.stuid and a.schyear=c.schyear and b.subjectcode=c.subjectcode and b.testlevel=c.testlevel left outer join tb_hka_section d on a.suid=d.suid and a.schyear=d.schyear and c.subjectcode=d.subjectcode and c.sectioncode=d.sectioncode and b.testlevel=d.testlevel where a.schyear=? and a.classlvl =? order by a.classcode, a.classno, a.enname