Ok, scrub that.
It's not working right. It's coming out with the wrong numbers.
Currently, there is only one Charity with any Payments logged against it. There are two payments logged for that Charity. Since the most recent of these payment dates, there have been 12 Greetings for that Charity.
As it stands, the query correctly pulls out one row for that Charity, correctly displays the latest of the two payment dates, and claims it's found not 12 but 24 Greetings.
If I amend the query with:
GROUP BY g.idCharities, cp.idCharityPayments
then I'm back down to 12 Greetings - but it shows two rows for the Charity.
How can I get it to display one row, with the latest payment date, and only SUM the Greetings once?
