Fundraising tech/queries

From mediawiki.org

Checking for multiple donations from one donor (2020-01-29)

select e.email, 
max(receive_date),
count(*),
original_amount,
original_currency
from civicrm_contribution c
inner join wmf_contribution_extra x on x.entity_id=c.id
inner join civicrm_email e on c.contact_id = e.contact_id AND e.is_primary=1
where receive_date>'2020-01-23'
group by
  e.email,
  x.original_amount,
  x.original_currency
having count(*) > 1 and timediff(max(receive_date), min(receive_date)) < '00:15:00'
order by max(receive_date);