Specifies a restriction over the groups of the query.
Replaces any previous having restrictions, if any.

@param mixed $having The restriction over the groups.

@return self
189611
public function having($having)
    {
        if (! (func_num_args() === 1 && ($having instanceof Expr\Andx || $having instanceof Expr\Orx))) {
            $having = new Expr\Andx(func_get_args());
        }

        return $this->add('having', $having);
    }
640928
public function setGroups($groups=null) {
		if(!is_array($groups) && $groups !== null)
			$groups = [$groups];
		$this->groups = $groups;
		return $this;
	}
444647
public function having($having)
    {
        if (is_string($having)) {
            $having = [$having];
        }

        $this->having = $having;
        return $this;
    }
211781
public function setHaving($having)
    {
        $having = func_num_args() > 1 ? func_get_args() : $having;
        $this->having = array();
        return $this->addHaving($having);
    }
182089
public function setGroup($group)
    {
        if (!empty($group)) {
            $this->query['group'] = $group;
        } else {
            unset($this->query['group']);
        }
        return $this;
    }
293805
public function where($conditions)
    {
        if ($conditions = is_array($conditions) && func_num_args() === 1 ? $conditions : func_get_args()) {
            $this->_parts['where'][] = $conditions;
        }
        return $this;
    }
82819
public SqlBuilder having(final String what) {
    Assert.isTrue(null != groups && !groups.isEmpty());
    if (Strings.isNotEmpty(what)) having = what;
    return this;
  }
382782
public function having( $expression ) {
		$this->expressionValidator->validate( $expression, ExpressionValidator::VALIDATE_FUNCTION );

		$this->usageValidator->trackUsedPrefixes( $expression );
		$this->usageValidator->trackUsedVariables( $expression );
		$this->modifiers['HAVING'] = '(' . $expression . ')';
	}
1299271
public function having($having, $bind = [])
    {
        if (is_array($having)) {
            if (count($having) === 1) {
                $this->_having = $having[0];
            } else {
                $items = [];
                /** @noinspection ForeachSourceInspection */
                foreach ($having as $item) {
                    $items[] = '(' . $item . ')';
                }
                $this->_having = implode(' AND ', $items);
            }
        } else {
            $this->_having = $having;
        }

        if ($bind) {
            $this->_bind = array_merge($this->_bind, $bind);
        }

        return $this;
    }
355958
public function having($sql, array $arguments)
    {
        $this->havingSql       = ' HAVING ' . $sql;
        $this->havingArguments = $arguments;
        return $this;
    }
274005
public function orWhere(...$conditions) : self
    {
        $this->conditionalQueryBuilder->orWhere(
            ...$this->createConditionExpressions($conditions)
        );

        return $this;
    }
432341
public function group($rule, $having = null){
		if($this->validateConditions())
			return $this;

		$this->resetState();
		$this->grouping = array($rule, $having);
		return $this;
	}
1233318
public function having($conditions, $params = array())
    {
        $this->mergeParams($params);
        $this->query['having'] = $this->buildConditions($conditions);

        return $this;
    }
270124
public function distinct(): self
    {
        // emulate SELECT DISTINCT with grouping by primary key
        $primaryColumn = $this->getModelSchemas()->getPrimaryKey($this->getModelClass());
        $this->addGroupBy($this->getQuotedMainAliasColumn($primaryColumn));

        return $this;
    }
463187
public function having()
    {
        $rel = $this->currentOrClone();
        
        if (!$rel->having) {
            $rel->having = new Having($rel);
        }
        
        if (func_num_args()) {
            call_user_func_array([$rel->having, 'condition'], func_get_args());
        }
        return $rel->having;
    }
423197
public function orHaving($having)
    {
        $args   = func_get_args();
        $having = $this->getQueryPart('having');

        if ($having instanceof CompositeExpression && $having->getType() === CompositeExpression::TYPE_OR) {
            $having->addMultiple($args);
        } else {
            array_unshift($args, $having);
            $having = new CompositeExpression(CompositeExpression::TYPE_OR, $args);
        }

        return $this->add('having', $having);
    }
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;
    }