public function group_by($by, $escape = NULL)
{
is_bool($escape) or $escape = $this->_protect_identifiers;
if (is_string($by)) {
$by = $escape === TRUE ? explode(',', $by) : array($by);
}
foreach ($by as $val) {
$val = trim($val);
if ($val !== '') {
$val = array('field' => $val, 'escape' => $escape);
$this->qb_groupby[] = $val;
if ($this->qb_caching === TRUE) {
$this->qb_cache_groupby[] = $val;
$this->qb_cache_exists[] = 'groupby';
}
}
}
return $this;
}