SELECT IFNULL(A.NO, 0) NEXT_NO, IFNULL(B.NO, 0) PREV_NO FROM
( ( SELECT MIN(NO) NO FROM TB_BOARD_LIST_001 WHERE BOARD_CODE = 'test_board' AND BOARD_SEQ > '158919' AND BOARD_SEQ < '158934' AND DELETED = 'N' ) A,
( SELECT MAX(NO) NO FROM TB_BOARD_LIST_001 WHERE BOARD_CODE = 'test_board' AND BOARD_SEQ < '158919' AND BOARD_SEQ > '158804' AND DELETED = 'N' ) B );
|