From 1e7a8a53679a72e862a0209da7bbe2d50c24e0a5 Mon Sep 17 00:00:00 2001 From: Coleman Watts <coleman@civicrm.org> Date: Thu, 18 Jul 2013 18:01:08 -0700 Subject: [PATCH] Fix multiple rows per contact CRM-12638 ---------------------------------------- * CRM-12638: Optimize Prev/Next Cache and search interaction http://issues.civicrm.org/jira/browse/CRM-12638 --- CRM/Contact/BAO/Query.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 7cc40b691b..e57b2a8eab 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4224,11 +4224,12 @@ civicrm_relationship.start_date > {$today} */ function getCachedContacts($cacheKey, $offset, $rowCount, $includeContactIds) { $this->_includeContactIds = $includeContactIds; - list($select, $from, ) = $this->query(); + list($select, $from) = $this->query(); $from = " FROM civicrm_prevnext_cache pnc INNER JOIN civicrm_contact contact_a ON contact_a.id = pnc.entity_id1 AND pnc.cacheKey = '$cacheKey' " . substr($from, 31); $order = " ORDER BY pnc.id"; + $groupBy = " GROUP BY contact_a.id"; $limit = " LIMIT $offset, $rowCount"; - $query = "$select $from $order $limit"; + $query = "$select $from $groupBy $order $limit"; return CRM_Core_DAO::executeQuery($query); } -- GitLab