with t as (
select 2 num from dual
union all select 6 from dual
)
select level from dual connect by level <= (select max(num) from t)
minus
select num from t
;
by 와아아앙
[2020.11.27 13:51:33]
네 감사합니다.
근데 대상 테이블에 데이터가 없으면 1이 조회되네요..
by 마농
[2020.12.01 13:09:37]
WITH t AS
(
SELECT 2 num FROM dual
UNION ALL SELECT 6 FROM dual
)
SELECT LEVEL lv
FROM (SELECT MAX(num) num FROM t)
WHERE LEVEL <= num -- 없으면 안나오게
CONNECT BY LEVEL <= num
MINUS
SELECT num FROM t
;
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.