CRM-18439 - Report Fixes to include Full Group by clause
[civicrm-core.git] / CRM / Report / Form / Event / ParticipantListCount.php
index 390e50a66c1cc09b534a262e7b4d13432441d50d..e6adfd7769778f2d2049fa718db0e0e30e8ad99f 100644 (file)
@@ -425,6 +425,7 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event {
         $this->_columnHeaders["blank_{$i}"]['title'] = "_ _ _ _";
       }
     }
+    $this->_selectClauses = $select;
     $this->_select = "SELECT " . implode(', ', $select) . " ";
   }
 
@@ -475,6 +476,7 @@ class CRM_Report_Form_Event_ParticipantListCount extends CRM_Report_Form_Event {
     parent::groupBy();
     if (empty($this->_groupBy)) {
       $this->_groupBy = "GROUP BY {$this->_aliases['civicrm_participant']}.id";
+      $this->_groupBy .= CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, "{$this->_aliases['civicrm_participant']}.id");
     }
   }