function aggregate( $function ) {

        if ( $this->parent_ ) {

            throw new \LogicException( 'Cannot aggregate referenced result' );

        }

        $statement = $this->db->select( $this->table, array(
            'expr' => $function,
            'where' => $this->where,
            'orderBy' => $this->orderBy,
            'limitCount' => $this->limitCount,
            'limitOffset' => $this->limitOffset,
            'params' => $this->whereParams
        ) );

        foreach ( $statement->fetch() as $return ) {

            return $return;

        }

    }