How do I sort contributions in our database by the most recent contribution date? When I try to search this on the database, it brings up all contributions, not just the most recent and I want to target specific members who have not donated recently. Thanks!

  • 1
    Can you be a bit more specific. Are you using Advanced Search, or Find Contributions, and if so why doesn't setting the date field filter to just the more recent ones – petednz - fuzion Dec 1 '16 at 3:04
  • What I meant by "recent" was that I was getting multiple results for many people and I wanted to only the latest contribution they had made – Erin Dec 12 '16 at 22:37

Summary Fields Extension may be your friend. It will create calculated fields for 'latest donation' (and many other such fields) and these are then available in eg Adv Search.

Let us know if that helps with what you are after

| improve this answer | |

If I am not wrong you need a SQL Script to list all the contribution in descenting order (Recent transaction) based on a specific membership type ?

If yes, then use this SQL which will give you recent contribution record based on the membership type - so you need to know all the membership type id and replace in the membership_type_id in the SQL below

select * from civicrm_contribution a

LEFT JOIN civicrm_membership_payment b ON a.id = b.contribution_id

LEFT JOIN civicrm_membership c ON c.id = b.membership_id

WHERE a.contribution_status_id = 2 and c.membership_type_id = 'membership_type_id'


I guess this helps!!!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.