「Oracle」RANK() OVER (PARTITION BY )でランキングを表示するサンプル
サンプルコード:
SELECT
TO_CHAR(BIRTHDAY_YMD, 'YYYY/MM/DD’)
, RANK() OVER (
PARTITION BY
A.AREA_ID
, A.CITY_CODE
ORDER BY
A.BIRTHDAY_YMD DESC NULLS LAST
) CFT
FROM
TEST A
Coding Changes the World
サンプルコード:
SELECT
TO_CHAR(BIRTHDAY_YMD, 'YYYY/MM/DD’)
, RANK() OVER (
PARTITION BY
A.AREA_ID
, A.CITY_CODE
ORDER BY
A.BIRTHDAY_YMD DESC NULLS LAST
) CFT
FROM
TEST A