# Write your MySQL query statement below
select query_name, round(avg(rating/position), 2) quality, round(avg(if (rating<3,1,0))*100, 2) poor_query_percentage from Queries
group by query_name
# Write your MySQL query statement below
select t.query_name, round(avg(t.quality),2) as quality, round(avg(t.poor_query_percentage),2) as poor_query_percentage from
(
select query_name, sum(rating/position) as quality, if(rating<3,1,0)*100 as poor_query_percentage from Queries group by query_name, result, position, rating
) as t
where t.query_name is not null
group by query_name
Compare these 2 solutions... If you want a sum()
maybe you just need a group by
.