select a.id_progdi, a.nama_progdi, avg(b.ipk)
from tb_ipk b
join tb_mahasiswa c on b.nim = c.nim
join tb_progdi a on c.id_progdi = a.id_progdi
group by id_progdi
您有多个id_progdi
,因此可能不知道在group by
中引用哪一个。将其更改为group by a.id_progdi
在分组依据中,您应该添加表别名,因为您在多个表中具有相同的列名,并且数据库引擎需要知道您要引用哪个列名
select a.id_progdi, a.nama_progdi, avg(b.ipk)
from tb_ipk b
join tb_mahasiswa c on b.nim = c.nim
join tb_progdi a on c.id_progdi = a.id_progdi
group by a.id_progdi, a.nama_progdi
也许您在多个表中id_progdi在分组依据中使用表别名。