Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I want to write a query to find out how many students got average GPA? I am getting right answer when i just find out average GPA, but i don't know how to count the number of students who got average GPA.
here is my query, but it is not giving the right answer
Select count (Sid), Avg (GPA)
from Student
group by Sid

What I have tried:

Select count (Sid), Avg (GPA)
from Student
group by Sid
Posted
Comments
[no name] 10-Feb-16 1:25am    
Provide demo data with your need(what output do you need)?

1 solution

Try:
SQL
SELECT COUNT(*) 
FROM Student a
JOIN (SELECT AVG(GPA) AS av FROM Student) b
ON a.GPA = b.av
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900