select avg(select count(aid)
from athlete
group by codepays)
I get a "more than one row error". How with I go about getting the average of the result from my fist select ?
You need to use a table expression (subquery).
For example:
select avg(cnt)
from (
select count(aid) as cnt
from athlete
group by codepays
) x