我需要为多名学生重复下面的连接。如何优化并将其作为单个查询编写?
select * from percentage perct
join subject subj ON perct.subject_id=subj.subject_id
join student std ON subj.student_id = std.sutdent_id
Where std.student_name="xyz" and std.location="abc" and age="18"
select * from percentage perct
join subject subj ON perct.subject_id=subj.subject_id
join student std ON subj.student_id = std.sutdent_id
Where std.student_name="ccc" and std.location="kkk" and age="19"
答案 0 :(得分:0)
select * from percentage perct
join subject subj ON perct.subject_id=subj.subject_id
join student std ON subj.student_id = std.sutdent_id
Where (std.student_name="xyz" and std.location="abc" and age="18")
or (std.student_name="ccc" and std.location="kkk" and age="19")