> 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 = 'Chem' AND sg2.Grade = 'A'
> So i have to write 3 join if I have 3 conditions and so on, right? Yes, if you use this approach, you'll need another JOIN and another two conditions in the WHERE clause. If you use the IN()...HAVING approach, then you just need to add the new subject to the IN() function and change the HAVING COUNT(*) = 2 to = 3. (As was pointed out, this approach won't work if you have two Maths grades and no Chem grades.) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]