SQL Query Help - Return row in table which relates to another table row with max(column)

Posted by Seth on Stack Overflow See other posts from Stack Overflow or by Seth
Published on 2010-06-13T05:58:56Z Indexed on 2010/06/13 6:02 UTC
Read the original article Hit count: 255

Filed under:
|

I have two tables:

Table1 = Schools
    Columns: id(PK), state(nvchar(100)), schoolname

Table2 = Grades
    Columns: id(PK), id_schools(FK), Year, Reading, Writing...

I would like to develop a query to find the schoolname which has the highest grade for Reading.

So far I have the following and need help to fill in the blanks:

SELECT Schools.schoolname, Grades.Reading
FROM Schools, Grades
WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2008