Thursday, January 1, 2009

ORA-00979: not a GROUP BY expression

select e.deptno,
d.deptno,sum(e.sal) from dept d,e emp
where d.deptno=e.deptno group by e.deptno

d.deptno,sum(e.sal) from d dept,e emp
*
ERROR at line 2:
ORA-00979: not a GROUP BY expression


GROUP BY clause should contain all the columns
(without group function) in the query

select e.deptno,
d.deptno,sum(e.sal) from dept d,emp e
where d.deptno=e.deptno group by e.deptno,d.deptno;

No comments:

Post a Comment