oracle sql请求列定义不明确

oracle sql请求列定义不明确,sql,oracle,oracle11g,ora-00918,Sql,Oracle,Oracle11g,Ora 00918,我正在处理oracle 11g并尝试执行此请求 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_m

我正在处理oracle 11g并尝试执行此请求

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;
但是它说

 ORA-00918: column ambiguously defined
00918. 00000 -  "column ambiguously defined"
*Cause:    
*Action:
Error on line 6, colunn 19
有什么问题吗?如果我执行这个请求,它就会工作

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;

note
exam
mod
INTITULE
code-et
nom
列中,至少有两列位于
note
test
etudiant
表中,并且不带别名

例如,
模块
检查
表都包括
code\u mod
列,并且在选择列表中没有显示它的来源

这样使用:

select m.code_mod,intitule,et.code_et,nom ,avg(note)
  from note n
 inner join exam e on ( n.code_ex = e.code_ex )
 inner join module m on ( e.code_mod=m.code_mod )
 inner join etudiant et on ( et.code_et = n.code_et )
group by m.code_mod,intitule,et.code_et,nom 
order by m.code_mod;

并且您应该包括
group by
表达式中的所有列,而不使用
分组函数

您在查询中涉及的多个表中有同名的列,因此您必须使用正确的表名作为列的前缀,例如:

select 
    EXAM.code_mod, INTITULE, EXAM.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 
    EXAMcode_mod, EXAM.code_et, INTITULE, nom
order by 
    EXAM.code_mod;

在问这个问题之前我试过了,但是上面写着Erreur-SQL:ORA-00979:not a GROUP BY expression 00979。00000-“不是一个按表达式分组”应答更新,所有列不在GROUP BY中的聚合函数中。之前已经尝试过,但ORA-00979:不是一个按表达式分组00979。00000—“不是表达式分组”-在ANSI-92 SQL标准(25年前!)中,旧式逗号分隔的表列表样式被正确的ANSI
JOIN
语法所取代,不鼓励使用它