Changes between Version 1 and Version 2 of Ticket #30099


Ignore:
Timestamp:
Jan 12, 2019, 6:35:39 AM (5 years ago)
Author:
MrFus10n
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30099 – Description

    v1 v2  
    4848}}}
    4949
    50 If I remove line {{{.filter(author_name=OuterRef('name'))}}} or {{{.filter(cnt__gt=3)}}} query stops raising error.
     50If I remove line {{{.filter(cnt__gt=3)}}}, last {{{GROUP BY}}} disappears and query stops raising error:
     51
     52{{{
     53SELECT "core_author"."id", "core_author"."name", (
     54    SELECT COUNT(U0."book_category") AS "cnt"
     55    FROM "core_book" U0 WHERE U0."id" = ("core_author"."chat_id")
     56    GROUP BY U0."id" HAVING COUNT(U0."book_category") > 3
     57    ORDER BY "cnt" ASC  LIMIT 1)
     58AS "min_valuable_count"
     59FROM "core_author"
     60GROUP BY "core_author"."id", "U0"."id"
     61}}}
     62
     63Is there any way to remove GROUP BY in outer query without removing .filter(cnt__gt=3) in subquery?
Back to Top