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.

Nitin SontakkePosted Jul 25, 2023, 4:43 AM
select PolicyNo, min(AmortDate), max(AmortDate)
from tblPolicyPaymentSchedule
where DaidPaid is null
group by PolicyNo
Anandu G NathPosted Dec 20, 2023, 5:38 AM
select PolicyNo
from tblPolicyPaymentSchedule
where DaidPaid <>null
order by DatePaid Desc