def as_sql(self):
    '\n        Creates the SQL for this query. Returns the SQL string and list of\n        parameters.\n        '
    if (not self.query.subquery):
        raise EmptyResultSet
    (sql, params) = ([], [])
    for annotation in self.query.annotation_select.values():
        (ann_sql, ann_params) = self.compile(annotation, select_format=True)
        sql.append(ann_sql)
        params.extend(ann_params)
    self.col_count = len(self.query.annotation_select)
    sql = ', '.join(sql)
    params = tuple(params)
    sql = ('SELECT %s FROM (%s) subquery' % (sql, self.query.subquery))
    params = (params + self.query.sub_params)
    return (sql, params)
Creates the SQL for this query. Returns the SQL string and list of
parameters.
def as_sql(self):
    '\n        Creates the SQL for this query. Returns the SQL string and list of\n        parameters.\n        '
    if (not self.query.subquery):
        raise EmptyResultSet
    (sql, params) = ([], [])
    for annotation in self.query.annotation_select.values():
        (ann_sql, ann_params) = self.compile(annotation, select_format=True)
        sql.append(ann_sql)
        params.extend(ann_params)
    self.col_count = len(self.query.annotation_select)
    sql = ', '.join(sql)
    params = tuple(params)
    sql = ('SELECT %s FROM (%s) subquery' % (sql, self.query.subquery))
    params = (params + self.query.sub_params)
    return (sql, params)