public function aggregate($function, $fields=null)
    {
        $query = clone $this->_query;

        return $query->select(sprintf('%s(%s)', $function, $fields))->execute()->scalar();
    }
public function aggregate($function, $fields=null)
    {
        $query = clone $this->_query;

        return $query->select(sprintf('%s(%s)', $function, $fields))->execute()->scalar();
    }
public function aggregate ( $ function , $ fields = null ) { $ query = clone $ this -> _query ; return $ query -> select ( sprintf ( '%s(%s)' , $ function , $ fields ) ) -> execute ( ) -> scalar ( ) ; }
helpers for common aggregate functions
helpers for common aggregate functions