본문 바로가기

DATABASE

이전글, 다음글 Query.

SELECT  BOARD_CODE, BOARD_TITLE
FROM     T_BOARD
WHERE   BOARD_CODE IN
  (
   (SELECT MAX(BOARD_CODE) FROM T_BOARD WHERE BOARD_CODE < 2),
   (SELECT MAX(BOARD_CODE) FROM T_BOARD WHERE BOARD_CODE = 2),
   (SELECT MIN(BOARD_CODE) FROM T_BOARD WHERE BOARD_CODE > 2)
  )
ORDER BY BOARD_CODE ASC;