0

How to calculate an average and use that average to select some data?
e.g. for this query and its result.

select Proposal_ID, Mark, AVG(Mark) AS Average from proposal where (Proposal_ID >= 931) GROUP BY Proposal_ID
931        20         22.2222    
935        30         22.2222    
936        30         21.1111    
967        30         25.5556    
968        30         20.0000    
994        30         19.4444    
995        20         15.5556    
1010       30         17.7778    
1011       20         17.5000    
1015       20         17.7778    
1018       20         17.7778    
1020       30         18.8889    
1049       30         20.0000    
1050       30         22.5000    
1051       0          15.5556    
1052       10         17.7778    
1053       30         23.3333

How to refine the query so that after the average is calculated, then select those Proposal_ID where its average >= 20?

Edited by albertkao: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by smantscheff
0
SELECT Proposal_ID, Mark, AVG(Mark) AS Average FROM proposal WHERE (Proposal_ID >= 931) GROUP BY Proposal_ID HAVING Average >= 20;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.