maxMinAvgSum example

return $this;
    }

    /** * Generates a SELECT MAX(field) portion of a query * * @return $this */
    public function selectMax(string $select = '', string $alias = '')
    {
        return $this->maxMinAvgSum($select$alias);
    }

    /** * Generates a SELECT MIN(field) portion of a query * * @return $this */
    public function selectMin(string $select = '', string $alias = '')
    {
        return $this->maxMinAvgSum($select$alias, 'MIN');
    }

    
/** * SELECT [MAX|MIN|AVG|SUM|COUNT]() * * Handle float return value * * @return BaseBuilder */
    protected function maxMinAvgSum(string $select = '', string $alias = '', string $type = 'MAX')
    {
        // int functions can be handled by parent         if ($type !== 'AVG') {
            return parent::maxMinAvgSum($select$alias$type);
        }

        if ($select === '') {
            throw DataException::forEmptyInputGiven('Select');
        }

        if (strpos($select, ',') !== false) {
            throw DataException::forInvalidArgument('Column name not separated by comma');
        }

        if ($alias === '') {
            
Home | Imprint | This part of the site doesn't use cookies.