Oracle中emp表操作

查询每个部门下最早的员工信息sql:
select *
from scott.emp f,
(select deptno, min(hiredate) hiredate
from scott.emp
group by scott.emp.deptno) d
where f.hiredate = d.hiredate;
结果:
1 7369 SMITH CLERK 7902 1980-12-17 800.00 20 20 1980-12-17
2 7499 ALLEN SALESMAN 7698 1981-2-20 1600.00 300.00 30 30 1981-2-20
3 7782 CLARK MANAGER 7839 1981-6-9 2450.00 10 10 1981-6-9

你可能感兴趣的:(Oracle)