We detected recently some duplicate contributions records. How to make a list of all duplicates? We use the field "source" to indicate the year of the contribution. So we are looking of a list of duplicate contributions for instance for source = "2017"
We found a solution by using this SQL query:
/* === Duplicate contributions === */ /* c contact * b contribution * t temporary */ SELECT b.contact_id ContactID, c.last_name Last name, c.first_name First name, b.source Year, b.total_amount Contribution, b.receive_date Received, b.receipt_date Processed FROM civicrm_contribution b JOIN ( select b.contact_id, b.source, count(*) from civicrm_contribution b group by b.contact_id, b.source having count(*) > 1 ) t on b.contact_id = t.contact_id and b.source = t.source INNER JOIN civicrm_contact c ON b.contact_id=c.id