Answer the question
In order to leave comments, you need to log in
How to find the average value?
select subject, role
from tetrika.lessons as tl, tetrika.users as tu
where tu.role = 'tutor'
group by role, tutor_id, tu.id, subject
having tl.tutor_id = tu.id
select (sum(subject) :: int / count(subject)) as subject_avg, subject, role
from tetrika.lessons as tl, tetrika.users as tu
where tu.role = 'tutor'
group by role, tutor_id, tu.id, subject
having tl.tutor_id = tu.id
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question