ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [DATABASE] ROWNUM 생성
    프로그래밍/Database 2020. 4. 9. 11:51

    1. Mysql

          SELECT 
              @ROWNUM :=@ROWNUM+1 AS IDX, A.* 
          FROM ( 
              SELECT 
                  * 
              FROM [조회 대상 테이블]
          ) A, (SELECT @ROWNUM :=0) R

    2. Oracle

          SELECT 
              ROWNUM AS IDX
              , A.*
          FROM (
             SELECT 
                 * 
             FROM [조회 대상 테이블]
          ) A

Designed by Tistory.