任何人都可以帮助查询选择仅在特定主题中输入而不在其他主题中输入的学生。假设我只在“Eng.Maths”中说。
STUDENT SUBJECT MARK
Vels Eng.Maths 60
Vels Data.Mining 65
Stivel Eng.Maths 55
Stivel Data.Mining 69
Raj Eng.Maths 66
答案 0 :(得分:4)
SELECT * FROM Table1 t1
WHERE subject = 'Eng.Maths'
AND NOT EXISTS (SELECT NULL FROM Table1 t2
WHERE t1.Student = t2.Student
AND t2.Subject <> t1.subject)