응용 SoftWare/Oracle

다중열 서브쿼리

Hyun CHO 2017. 1. 12. 11:36

-- 다중열 서브쿼리

-- 쌍비교

select * from emp where (sal, deptno) in (select sal, deptno from emp where deptno=30 and comm is not null);


select empno, ename, job, deptno from emp where(job, sal) in (select job, min(sal) from emp group by job) order by job;


-- 비쌍비교

select empno, sal, deptno from emp where sal in (select sal from emp where deptno=30 and comm is not null)

and

deptno in (select deptno from emp where deptno=30 and comm is not null);