Skip to content

Instantly share code, notes, and snippets.

@jkdeveyra
Last active August 29, 2015 14:20
Show Gist options
  • Save jkdeveyra/7732f96a2848ca6785a6 to your computer and use it in GitHub Desktop.
Save jkdeveyra/7732f96a2848ca6785a6 to your computer and use it in GitHub Desktop.
225 Hour Training Reminder with free HYTV
select a.* from (
select ac.contact_id, a.* from civicrm_activity a
join civicrm_activity_contact ac on ac.activity_id=a.id and ac.record_type_id = 3
join civicrm_option_value v on v.value=a.activity_type_id and v.option_group_id = 2 and v.name like '%225 Download Packet%'
join civicrm_contact c on c.id = ac.contact_id
where c.is_deleted = 0
) as a
LEFT JOIN
(
select ac.contact_id from civicrm_activity a
join civicrm_activity_contact ac on ac.activity_id=a.id and ac.record_type_id = 3
join civicrm_option_value v on v.value=a.activity_type_id and v.option_group_id = 2 and v.name like '%225 Registration Completed%'
) as b
ON a.contact_id = b.contact_id
WHERE b.contact_id IS NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment