> Select s.StudentID, s.StudentName from Student s, SubjectGrade sg where > s.StudentID = sg.StudentID and sg.Subject = 'Maths' and sg.Subject = 'Chem' > and sg.Grade = 'A'
Take a close look at the WHERE clause: "sg.Subject = 'Maths' and sg.Subject = 'Chem'" will never return a result - how could the subject be two different things at the same time? Here's one way that should work: SELECT s.StudentID, StudentName FROM Student s JOIN StudentGrade sg1 USING (StudentID) JOIN StudentGrade sg2 USING (StudentID) WHERE sg1.Subject = 'Maths' AND sg1.Grade = 'A' AND sg2.Subject = 'Chen' AND sg2.Grade = 'A' -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]