Hello everyone,
I have a table with multiple policy numbers and payment schedules and actual payments made as shown below

How can I get the last AmortDate paid and the first AmortDate after the last payment which was not paid without using the policy number as a parameter? Please take note that I have multiple policy numbers in my table. Thank you in advance.