방명록
- ROW_NUMBER()2019년 04월 15일 17시 59분 40초에 업로드 된 글입니다.작성자: 봉주니
그룹별 ROWNUM 주기
SELECT
ROW_NUMBER() OVER(PARTITION BY COLUMN.A ORDER BY COLUMN.A, COLUMN.B) AS RNUM,
COLUMN.A,
COLUMN.B
FROM
TABLE
GROUP BY COLUMN.A, COLUMN.B
(EXAMPLE)
SELECT ITEM_NM,
GT
FROM ZTMP_EI_BNDITEM GT NETWORK EQUIPMENT1 6 NETWORK EQUIPMENT2 3.5 NETWORK EQUIPMENT3 3.7 NETWORK EQUIPMENT4 3.5 NETWORK EQUIPMENT5 7.1 USED NETWORK EQUIPMENT1 2.3 USED NETWORK EQUIPMENT2 6.5 USED NETWORK EQUIPMENT3 7 USED NETWORK EQUIPMENT4 6 SELECT ITEM_NM,
GT,ROW_NUMBER() OVER (ORDER BY GT) AS NUMBER
FROM ZTMP_EI_BNDITEM GT NUMBER USED NETWORK EQUIPMENT 2.3 1 USED NETWORK EQUIPMENT 3.5 2 USED NETWORK EQUIPMENT 3.5 3 NETWORK EQUIPMENT 3.7 4 NETWORK EQUIPMENT 6 5 NETWORK EQUIPMENT 6 6 NETWORK EQUIPMENT 6.5 7 USED NETWORK EQUIPMENT 7 8 NETWORK EQUIPMENT 7.1 9 반응형'Oracle' 카테고리의 다른 글
Insert 시 & 대체 변수 입력 (0) 2019.08.06 mybatis like # (0) 2019.05.08 ORACLE SYNONYM(시노님) (0) 2019.04.15 실행계획 확인하기 (0) 2017.04.07 해당 연도의 첫날과 마지막날 표시 (0) 2016.05.03 다음글이 없습니다.이전글이 없습니다.댓글