RN PLAN_YM YM
1 201712 201712
1 201712 201801
1 201712 201802
2 201711 201711
2 201711 201712
2 201711 201801
3 201710 201710
3 201710 201711
3 201710 201712
...
12 201701 201701
12 201701 201702
12 201701 201703
이런 결과값을 나오게 하고 싶은데
RN이 모두 1로 나오는데 어떻게 쿼리를 수정해야 할지 몰라 질문 남깁니다.
쿼리문)
select rank() over(partition by plan_ym order by plan_ym desc) rnum,
plan_ym, ym
from (select DISTINCT plan_ym, ym from thf_store_sales_plan order by plan_ym desc);