Given an escaped HAVING clause, add it along with the appropriate GROUP BY clause
@param  DataQuery $query
@param  string    $having
@return DataQuery
967940
public function applyAggregate(DataQuery $query, $having)
    {
        $schema = DataObject::getSchema();
        $baseTable = $schema->baseDataTable($query->dataClass());

        return $query
            ->having($having)
            ->groupby("\"{$baseTable}\".\"ID\"");
    }
262242
protected function compileHavings(Builder $query, $havings)
    {
        $sql = implode(' ', array_map(array($this, 'compileHaving'), $havings));

        return 'having '.preg_replace('/and |or /', '', $sql, 1);
    }
68898
public function having($column, $operator = null, $value = null): BaseQueryRelateContract
    {
        $this->query->having($column, $operator, $value, 'and');

        return $this;
    }
592891
public function having() {
        $args = func_get_args();
        $this->build()->bindExpression('having', $args[0] . $args[1] . ' ? ');
        $this->build()->bindParams('having', $args[2]);

        return $this->connection;
    }
924624
public function having($conditions, $glue='AND')
  {
    if ( is_null($this->having) ){
      $glue = strtoupper($glue);
      $this->having = new Element('HAVING', $conditions, " $glue ");
    }
    else {
      $this->having->append($conditions);
    }

    return $this;
  }
574918
public function prepareHaving($havingObject)
    {
        $where = null;
        $params = [];
        if (!empty($havingObject)) {
            $arr = [];

            /** @var \Dframe\Database\Chunk\ChunkInterface $chunk */
            foreach ($havingObject as $chunk) {
                list($wSQL, $wParams) = $chunk->build();
                $arr[] = $wSQL;
                foreach ($wParams as $k => $v) {
                    $params[] = $v;
                }
            }

            $this->setHaving = ' HAVING ' . implode(' AND ', $arr);

            if (is_array($this->setParams) and !empty($this->setParams)) {
                $this->setParams = array_merge($this->setParams, $params);
            } else {
                $this->setParams = $params;
            }
        } else {
            $this->setHaving = null;
            //$this->setParams = [];
        }

        //if (!empty($order))
        //    $this->prepareOrder($order, $sort);
        //

        return $this;
    }
766365
public function having($sql=null, $params=array())
    {
        $this->_having = new Criteria($sql, $params);

        return $this;
    }
1290160
protected function compileBasicHaving($having)
	{
		$column = $this->wrap($having['column']);

		$parameter = $this->parameter($having['value']);

		return 'and '.$column.' '.$having['operator'].' '.$parameter;
	}
365063
public function augmentDataQueryCreation(SQLSelect &$query, DataQuery &$dataQuery)
    {
        // Convert reading mode to dataquery params and assign
        $args = ReadingMode::toDataQueryParams(Versioned::get_reading_mode());
        if ($args) {
            foreach ($args as $key => $value) {
                $dataQuery->setQueryParam($key, $value);
            }
        }
    }
82819
public SqlBuilder having(final String what) {
    Assert.isTrue(null != groups && !groups.isEmpty());
    if (Strings.isNotEmpty(what)) having = what;
    return this;
  }
410591
public function having(string $sql, array $params = []) : self
    {
        $this->qiterator = null;
        $this->having[] = [ $sql, $params ];
        return $this;
    }
1139434
protected function parseHaving($having)
    {
        $result = [];
        foreach($having as $item)
        {
            $result[] = $item->getLogicalOperator();
            $result[] = $item->toStringWithoutLogic();
            $this->params = array_merge($this->params, $item->getBinds());
        }
        array_shift($result);
        $result = implode(' ', $result);
        if('' !== $result)
        {
            $result = ' having ' . $result;
        }
        return $result;
    }
818612
public function apply(DataQuery $query)
    {
        if (($key = array_search('not', $this->modifiers)) !== false) {
            unset($this->modifiers[$key]);
            return $this->exclude($query);
        }
        if (is_array($this->value)) {
            return $this->applyMany($query);
        } else {
            return $this->applyOne($query);
        }
    }
922938
public function addHaving(array $having): void
    {
        if (empty($having)) {
            return;
        }

        $firstClause = true;
        $this->statement .= ' HAVING ';
        foreach ($having as $clause) {
            if ($firstClause === false) {
                $this->statement .= ' ' . $clause['concatenator'] . ' ';
            }
            $placeholder = $this->addBindingValue($clause['key'], $clause['value']);
            $key = $this->quoteName($clause['key']);
            $this->statement .= sprintf('%s %s %s', $key, $clause['operator'], $placeholder);
            $this->statement .= PHP_EOL;
            $firstClause = false;
        }
    }
615084
public function having($having) {
        if ($having instanceof Where) {
            $sql = $having->whereChildSql();
            $this->having_params = $having->whereParams();
            $having = $sql;
        }

        if ($having) {
            $this->having = ' HAVING ' . $having;
        }
        return $this;
    }
1102203
protected function compileBasicHaving($having): string {
        $column = $having['column'];

        $parameter = $this->parameter($having['value']);

        return $having['boolean'].' '.$column.' '.$having['operator'].' '.$parameter;
    }
753064
@NonNull
    @Override
    public Having having(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new Having(this, expression);
    }