这里不允许使用组功能

use*_*583 1 sql oracle sqlplus

当我运行以下查询时,我得到了

ORA-00934:此处不允许使用组功能

问题是什么 ?

select c.Numcom,c.Nompr,c.salaire_fix
from commercialv c,comercialv c1
where c.salaire_fix=(max(c1.salaire_fix) );
Run Code Online (Sandbox Code Playgroud)

Syl*_*oux 10

您不能在WHERE子句中使用聚合函数.

根据您的用例,您可能需要子查询:

select c.Numcom,c.Nompr,c.salaire_fix
from commercialv c
where c.salaire_fix=(select max(salaire_fix) from comercialv);
Run Code Online (Sandbox Code Playgroud)

理性是聚合函数工作在一个.WHERE另一方面,该子句只能访问一行数据.