Işıl Demirci
Işıl Demirci

Reputation: 1

Error Code: 1111. Invalid use of group function MYSQL ERROR

I´m trying to find a list of students who are below the average grade of course

I have this query

Select studentName 
from courseGrade 
where grade < avg(grade) and sectionID=290001

Upvotes: -1

Views: 53

Answers (1)

The Impaler
The Impaler

Reputation: 48875

Use a subquery to compute the average grade of the course. For example:

select studentName 
from courseGrade 
where sectionID = 290001
  and grade < (
    select avg(grade) from courseGrade where sectionID = 290001
  )

Upvotes: 2

Related Questions