def METHOD_NAME(self):
    """Return a list of records as specified in the given table config."""
    group_by = []
    # We replace the selects from the analytics query with
    # the aggregate function calls as required, but leave the
    # rest intact. This way, we won't need to build a subquery
    # around the whole thing and keep it relatively (!) simple
    aggregate_query = self.base_table.get_query_object()
    selects_by_alias = {
        alias: fragment for fragment, alias in aggregate_query.select
    }
    new_selects = []
    for field in self._fields:
        key = self._sql_alias(field.alias)
        # old field might be directly selected in the base query,
        # in which case we need to alias its expression. If it's
        # not directly in the base, it won't be in the top-level selects
        # list, but will be aliased to the known name in a subquery.
        old_field = selects_by_alias.get(key, key)
        new_alias = self._sql_alias(field.alias)
        if field.function == field.FUNCTION_VALUE:
            group_by.append(old_field)
            new_selects.append((old_field, new_alias))
        elif field.function != field.FUNCTION_VALUE:
            cast = FUNCTION_PARAMETER_CAST.get(field.function, "")
            new_selects.append((f"{field.function}({old_field}{cast})", new_alias))
    # TODO: instead of replacing selects, use sub-query
    aggregate_query.select = new_selects
    aggregate_query.group_by = group_by
    aggregate_query.select_direct_only = True
    sql_query, params, _ = sql.QueryRender(aggregate_query).as_sql(alias=None)
    return sql_query, params