CI_DB_query_builder::_max_min_avg_sum PHP Method

_max_min_avg_sum() protected method

SELECT [MAX|MIN|AVG|SUM]()
protected _max_min_avg_sum ( string $select = '', string $alias = '', string $type = 'MAX' ) : CI_DB_query_builder
$select string Field name
$alias string
$type string
return CI_DB_query_builder
    protected function _max_min_avg_sum($select = '', $alias = '', $type = 'MAX')
    {
        if (!is_string($select) or $select === '') {
            $this->display_error('db_invalid_query');
        }
        $type = strtoupper($type);
        if (!in_array($type, array('MAX', 'MIN', 'AVG', 'SUM'))) {
            show_error('Invalid function type: ' . $type);
        }
        if ($alias === '') {
            $alias = $this->_create_alias_from_table(trim($select));
        }
        $sql = $type . '(' . $this->protect_identifiers(trim($select)) . ') AS ' . $this->escape_identifiers(trim($alias));
        $this->qb_select[] = $sql;
        $this->qb_no_escape[] = NULL;
        if ($this->qb_caching === TRUE) {
            $this->qb_cache_select[] = $sql;
            $this->qb_cache_exists[] = 'select';
        }
        return $this;
    }