Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT SQL_CALC_FOUND_ROWS contact_civireport.sort_name AS civicrm_contact_contact_source,
- GROUP_CONCAT(DISTINCT civicrm_contact_assignee.sort_name ORDER BY activity_assignment_civireport.assignee_contact_id SEPARATOR '^A') AS civicrm_contact_contact_a
- ssignee,
- GROUP_CONCAT(DISTINCT civicrm_contact_target.sort_name ORDER BY activity_target_civireport.target_contact_id SEPARATOR '^A') AS civicrm_contact_contact_target,
- activity_civireport.id AS civicrm_activity_id, activity_civireport.source_record_id AS civicrm_activity_source_record_id,
- activity_civireport.activity_type_id AS civicrm_activity_activity_type_id, activity_civireport.subject AS civicrm_activity_activity_subject,
- activity_civireport.source_contact_id AS civicrm_activity_source_contact_id, activity_civireport.activity_date_time AS civicrm_activity_activity_date_time,
- activity_civireport.status_id AS civicrm_activity_status_id,
- GROUP_CONCAT(DISTINCT activity_assignment_civireport.assignee_contact_id ORDER BY activity_assignment_civireport.assignee_contact_id SEPARATOR '^A') AS civicrm_activity_assignment_assignee_contact_id,
- GROUP_CONCAT(DISTINCT activity_target_civireport.target_contact_id ORDER BY activity_target_civireport.target_contact_id SEPARATOR '^A') AS civicrm_activity_target_target_contact_id,
- case_activity_civireport.case_id AS civicrm_case_activity_case_id
- FROM civicrm_activity activity_civireport
- LEFT JOIN civicrm_activity_target activity_target_civireport
- ON activity_civireport.id = activity_target_civireport.activity_id
- LEFT JOIN civicrm_activity_assignment activity_assignment_civireport
- ON activity_civireport.id = activity_assignment_civireport.activity_id
- LEFT JOIN civicrm_contact contact_civireport
- ON activity_civireport.source_contact_id = contact_civireport.id
- LEFT JOIN civicrm_contact civicrm_contact_target
- ON activity_target_civireport.target_contact_id = civicrm_contact_target.id
- LEFT JOIN civicrm_contact civicrm_contact_assignee
- ON activity_assignment_civireport.assignee_contact_id = civicrm_contact_assignee.id
- INNER JOIN civicrm_acl_contact_cache aclContactCache_0 ON
- ( contact_civireport.id = aclContactCache_0.contact_id OR contact_civireport.id IS NULL )
- AND aclContactCache_0.user_id = 1332
- /* xxxxxxxxxxxxxxxxxxxxxx If the following 2 INNER JOINS are commented, the query xxxxxxxxxxxxx
- xxxxxxxxxxxxxxxxxxxxxx does not crash the MySQL server. If either are left in xxxxxxxxxxxxx
- xxxxxxxxxxxxxxxxxxxxxx a crash will occur. xxxxxxxxxxxxx
- */
- INNER JOIN civicrm_acl_contact_cache aclContactCache_1 ON ( civicrm_contact_target.id = aclContactCache_1.contact_id OR civicrm_contact_target.id IS NULL )
- AND aclContactCache_1.user_id = 1332
- INNER JOIN civicrm_acl_contact_cache aclContactCache_2 ON ( civicrm_contact_assignee.id = aclContactCache_2.contact_id OR civicrm_contact_assignee.id IS NULL )
- AND aclContactCache_2.user_id = 1332
- /* xxxxxxxxxxxxxxxxxxxxxx */
- LEFT JOIN civicrm_option_value
- ON ( activity_civireport.activity_type_id = civicrm_option_value.VALUE )
- LEFT JOIN civicrm_option_group
- ON civicrm_option_group.id = civicrm_option_value.option_group_id
- LEFT JOIN civicrm_case_activity case_activity_civireport
- ON case_activity_civireport.activity_id = activity_civireport.id
- LEFT JOIN civicrm_case
- ON case_activity_civireport.case_id = civicrm_case.id
- LEFT JOIN civicrm_case_contact
- ON civicrm_case_contact.case_id = civicrm_case.id
- WHERE civicrm_option_group.name = 'activity_type' AND
- activity_civireport.is_test = 0 AND
- activity_civireport.is_deleted = 0 AND
- activity_civireport.is_current_revision = 1 AND ( contact_civireport.id = 1332 OR civicrm_contact_assignee.id = 1332 OR civicrm_contact_target.id = 1332 ) AND ( activity_date_time >= 20121001000000 ) AND ( activity_date_time <= 20121031235959 ) AND ( activity_civireport.activity_type_id IN (28, 29) ) GROUP BY activity_civireport.id ORDER BY activity_civireport.source_contact_id ASC LIMIT 0, 50
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement