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;
}