WITH T(COL1) AS
(
SELECT 150 FROM DUAL UNION ALL
SELECT 100 FROM DUAL UNION ALL
SELECT 200 FROM DUAL
)
SELECT DECODE(COUNT(DISTINCT COL1),1,'Y','N') OK_OR_NO
FROM T
해당 컬럼 특정 ROW가 NULL일 경우는요? 제외하나요. 하나의 값으로 보나요?
by 우리집아찌
[2019.09.24 15:33:46]
WITH T AS (
SELECT 150 AS RST_QTY FROM DUAL UNION ALL
SELECT 100 AS RST_QTY FROM DUAL UNION ALL
SELECT 200 AS RST_QTY FROM DUAL
)
SELECT CASE WHEN MAX(RST_QTY) = MIN(RST_QTY) THEN 'OK' ELSE 'NO' END
FROM T
by 웅아
[2019.09.24 15:36:48]
감사합니다! MIN MAX를 활용할수도 있군요 캬..
댓글등록
SQL문을 포맷에 맞게(깔끔하게) 등록하려면 code() 버튼을 클릭하여 작성 하시면 됩니다.