-- 깔끔치 않네요 ㅡㅡ WITH T AS ( SELECT 1 SEQ , 'Y' COL_YN , 100 COL_VAL FROM DUAL UNION ALL SELECT 2 , 'N' , 200 FROM DUAL UNION ALL SELECT 3 , 'Y' , 50 FROM DUAL UNION ALL SELECT 4 , 'N' , 100 FROM DUAL ) SELECT T.SEQ , T.COL_YN , T.COL_VAL FROM T WHERE SIGN(T.COL_VAL - DECODE(T.COl_YN , 'Y' , 101 , 'N' , 100 )) = DECODE(T.COl_YN , 'Y' , -1 , 'N' , 0 )