多行子查询举例:从EMP表中查找各部门工资最高的员工。
SQL > SELECT ENAME, DEPTNO, SAL FROM EMP WHERE SAL IN (SELECT MAX(SAL) FROM EMP GROUP BY DEPTNO);
多行子查询举例:从EMP表中查找各部门工资最高的员工。
SQL > SELECT ENAME, DEPTNO, SAL FROM EMP WHERE SAL IN (SELECT MAX(SAL) FROM EMP GROUP BY DEPTNO);