I am working on oracle 11g and tried to execute this request
select code_mod,INTITULE,code_et,nom ,avg(note)
from note,exam,module,etudiant
where note.CODE_EX = exam.CODE_EX
and EXAM.CODE_MOD=MODULE.CODE_MOD
and NOTE.CODE_ET = ETUDIANT.CODE_ET
group by code_mod,code_et
order by code_mod;
but it says!
ORA-00918: column ambiguously defined
00918. 00000 - "column ambiguously defined"
*Cause:
*Action:
Error on line 6, colunn 19
what is wrong in it? if I execute this request, it works
select *
from note,exam,module,etudiant
where note.CODE_EX = exam.CODE_EX
and EXAM.CODE_MOD=MODULE.CODE_MOD
and NOTE.CODE_ET = ETUDIANT.CODE_ET;
you have at least two of
code_mod,INTITULE,code_et,nomcolumns innote,exam,module,etudianttables, and put them without aliases.As an example both
moduleandexamtable includecode_modcolumn, and in the select list you didn't show where it comes fromUse like this :
and you should include all columns in
group byexpression withoutgrouping functions.