MYSQL ROW_NUMBER() OVER(PARTITION BY AAA ORDER BY
카테고리 없음2015. 2. 14. 20:30
반응형
MYSQL ROW_NUMBER() OVER(PARTITION BY AAA ORDER BY
BBBB) AS rnum
(DB)MYSQL
SELECT
(CASE @vjob WHEN CUSTOMER_ID THEN @rownum:=@rownum+1 ELSE @rownum:=1 END) rnum,
(@vjob:=CUSTOMER_ID) vjob
,A.*
FROM RENTAL A ,(SELECT @vjob:=0, @rownum:=0 FROM DUAL) b
ORDER BY A.CUSTOMER_ID, A.INVENTORY_ID
반응형