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 SontakkeRank #264 · 9.6K reputationPosted Jul 25, 2023, 12:43 AM EDT
select PolicyNo, min(AmortDate), max(AmortDate)
from tblPolicyPaymentSchedule
where DaidPaid is null
group by PolicyNo
Anandu G NathRank #681 · 3.5K reputationPosted Dec 20, 2023, 12:38 AM EST
select PolicyNo
from tblPolicyPaymentSchedule
where DaidPaid <>null
order by DatePaid Desc