Query To pull most recent payment and amount
Posted on 2015-01-21
I know I can do this in code but I'm guessing there is a way to do it with a query, or 2.
These are the pertinent fields in my payment table:
TaxRecID :Id of the tax record payment is for. There may be multiple, or no payments for a given tax record.
PostedStatus :2 = posted. Posted payments are the only one's to be considered.
For any taxrecid's that have a posted payment, list the most recent posted payment, paymentdate and paymentamount. At most one payment should be shown for each taxrecid.
If there are no payments for a taxrecID te taxrecID does not have to be in the query results.