I'm trying to create a count where every time Agent Id shows up it would count one more than the previous month.
Image of end state:
You seem to be looking for row_number()
:
select t.*, row_number() over(partition by name order by d_month desc) cnt
from mytable t
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.