| 50 | | If I remove line {{{.filter(author_name=OuterRef('name'))}}} or {{{.filter(cnt__gt=3)}}} query stops raising error. |
| | 50 | If I remove line {{{.filter(cnt__gt=3)}}}, last {{{GROUP BY}}} disappears and query stops raising error: |
| | 51 | |
| | 52 | {{{ |
| | 53 | SELECT "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) |
| | 58 | AS "min_valuable_count" |
| | 59 | FROM "core_author" |
| | 60 | GROUP BY "core_author"."id", "U0"."id" |
| | 61 | }}} |
| | 62 | |
| | 63 | Is there any way to remove GROUP BY in outer query without removing .filter(cnt__gt=3) in subquery? |