Green World

반응형

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










반응형