특정구간을 통해서 결과값 구하기
====================================
SELECT
A.JUMSU, VALUE1, VALUE2
FROM
(
WITH T AS (
SELECT 10 JUMSU, '0' AS VALUE FROM DUAL UNION ALL
SELECT 7 , '2500' FROM DUAL UNION ALL
SELECT 8 , '1000' FROM DUAL UNION ALL
SELECT 6 , '1500' FROM DUAL UNION ALL
SELECT 3 , '2000' FROM DUAL)
SELECT
JUMSU, VALUE VALUE1,
NVL(LEAD(VALUE) OVER (ORDER BY VALUE),'9999') VALUE2
FROM
T
ORDER BY
VALUE) A
WHERE
VALUE1 < '100' AND VALUE2 >= '100'
'DB > Oracle 활용' 카테고리의 다른 글
제품별 FROM TO 날짜를 구하려고 합니다. (0) | 2020.02.12 |
---|---|
달력 팝업 창 쿼리 만들기 (0) | 2016.01.20 |