From 29ddb61bbcf0f50a0a5621c8dd03e44bd1a41446 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Thu, 22 Jun 2017 02:00:21 +0530 Subject: [PATCH] CRM-20411: mailing tab listing: MySQL 5.7 group by error --- api/v3/MailingContact.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/v3/MailingContact.php b/api/v3/MailingContact.php index b28f8bb0f6..b0fd28e891 100644 --- a/api/v3/MailingContact.php +++ b/api/v3/MailingContact.php @@ -164,6 +164,8 @@ GROUP BY m.id $orderBy = "ORDER BY $sort"; } + $groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns(array_keys($fields), "m.id"); + $sql = " SELECT $select FROM civicrm_mailing m @@ -174,7 +176,7 @@ INNER JOIN civicrm_mailing_event_queue meq ON meq.job_id = j.id WHERE j.is_test = 0 AND meq.contact_id = %1 $whereClause -GROUP BY m.id +{$groupBy} {$orderBy} "; -- 2.25.1