Skip to content
Snippets Groups Projects
Commit 0363d483 authored by jaapjansma's avatar jaapjansma
Browse files

update added distinct

parent 14d5aef0
No related branches found
No related tags found
No related merge requests found
......@@ -72,11 +72,12 @@ abstract class SqlDataFlow extends AbstractDataFlow {
try {
//$from = $this->getFromStatement();
$selectAndFrom = $this->getSelectQueryStatement();
$where = $this->getWhereStatement();
$groupBy = $this->getGroupByStatement();
$orderBy = $this->getOrderByStatement();
$countName = 'count_'.$this->getName();
$sql = "{$this->getSelectQueryStatement()} {$where} {$groupBy} {$orderBy}";
$sql = "{$selectAndFrom} {$where} {$groupBy} {$orderBy}";
$countSql = "SELECT COUNT(*) FROM ({$sql}) `{$countName}`";
//$countSql = "SELECT COUNT(*) AS `count` {$from} {$where} {$groupBy}";
......@@ -84,7 +85,6 @@ abstract class SqlDataFlow extends AbstractDataFlow {
$countDao = \CRM_Core_DAO::executeQuery($countSql);
$this->count = 0;
if (count($this->getFieldsForGroupByStatement()) > 0) {
$this->count = $countDao->N;
} else {
while ($countDao->fetch()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment