Hi, > SELECT * FROM students,grades WHERE students.ID=grades.ID AND grades.grade > > students.average_grade > > This doesn't work. It gets me all the occasions where a student has beaten > his average. But I only want students who have never gone below their > average! In other words, I want to select from the students table, based on > information on multiple rows in the grades table, where ALL the grades rows > need to fulfil a certain criterion.
I dunno but this _might_ work: SELECT * FROM students, grades WHERE students.ID = grades.ID AND min(grades.grade) > students.average_grade GROUP BY students.ID -- Aigars sql, mysql, query DISCLAIMER: Internet communications are not secure and therefore Defcom does not accept legal responsibility for the contents or accuracy of this message. The views and opinions contained in the message are solely those of the author and do not necessarily represent those of Defcom unless otherwise specifically stated. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php