Average of rows

Hello, I wanted to know if we can find the average of rows when the row it self has been set as “AS row_name”
here is my code
SELECT induk, nama,kelas, SUM(if (kdmapel=“111”,ratarata,0)) as MTK, SUM(if (kdmapel=“112”,ratarata,0)) as IPA, SUM(if (kdmapel=“115”,ratarata,0)) as PJOK, ((MTK+IPA+PJOK)/3) as NAR from nilai WHERE kelas=1 and semester=“ganjil” group by induk
in here I want to find the average of MTK+IPA+PJOK but it alwas said
#1054 - Unknown column ‘MTK’ in ‘field list’

Can you please format your code?
Also, can you provide the link to the CC lesson?

1 Like

It’s looking for those columns MTK, IPA, PJOK. Try verifying if those columns exist in the table.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.