select deptno,sum(salary) from emp group by deptno having count(empno) > 10;
select deptno,sum(SAL+nvl(COMM,0)) from emp group by DEPTNO having count(*) > 10;测试,由于数据库中没有那么多数据改成部门人数大于三了(另外我认为工资包含 sal 和 comm 两部分组成): [SCOTT@ora10gr1] SQL>select deptno,sum(SAL+nvl(COMM,0)) from emp group by DEPTNO having count(*) > 3; DEPTNO SUM(SAL+NVL(COMM,0)) ---------- -------------------- 20 10875 30 11600
select deptno,sum(SAL+nvl(COMM,0)) from emp group by DEPTNO having count(*) > 3;
[SCOTT@ora10gr1] SQL>select deptno,sum(SAL+nvl(COMM,0)) from emp group by DEPTNO having count(*) > 3; DEPTNO SUM(SAL+NVL(COMM,0))
---------- --------------------
20 10875
30 11600