ORA-00937: not a single-group group function


有時候查詢會遇到如下錯誤
 
SCOTT@PROD> select deptno,sum(sal) from emp;
select deptno,sum(sal) from emp
       *
ERROR at line 1:
ORA-00937: not a single-group group function
 
原因:這句話不會運行,因為deptno要求每行都顯示,而sum要求統計后再顯示,違反了原則。在有組函數的select中,不是組函數的列,一定要放在group by子句中。
 
正確語句:select deptno,sum(sal) from emp group by deptno;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM