Advertisement
Guest User

Retreat Reminder Query

a guest
Jul 29th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.60 KB | None | 0 0
  1. SELECT c.id AS contact_id, v.name, c.display_name FROM
  2. (SELECT id FROM civicrm_event WHERE event_type_id=10 AND is_template=0 LIMIT 1) e
  3. JOIN civicrm_option_value v ON v.option_group_id=2 AND v.name LIKE '%Registration Completed'
  4. JOIN civicrm_tag t ON t.name='No Selected Retreat'
  5. JOIN civicrm_activity a ON a.activity_type_id=v.VALUE
  6. JOIN civicrm_activity_contact ac ON ac.activity_id=a.id AND ac.record_type_id=3
  7. JOIN civicrm_entity_tag et ON et.entity_id=ac.contact_id AND et.entity_table='civicrm_contact' AND et.tag_id=t.id
  8. JOIN civicrm_contact c ON c.id=ac.contact_id
  9. WHERE c.is_deleted=0 GROUP BY c.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement