Changes between Initial Version and Version 1 of Ticket #10132
- Timestamp:
- Jan 27, 2009, 1:23:26 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #10132
- Property Summary QuerySet values() should work on extra(select) fields → Aggregations add extra values to ValuesQuerySets
-
Ticket #10132 – Description
initial v1 1 1 From http://groups.google.com/group/django-users/browse_frm/thread/15b3c24dddd2a2d5/2214eba4328126ca 2 2 {{{ 3 #!python 3 4 Item.objects.extra(select={"note_alias": "note"}).values("note_alias").annotate(Count("id")).order_by('note_id') 4 5 }}} 5 6 generates: 6 7 SELECT (note_id) AS "note_alias", U0."id", COUNT("queries_item"."id") AS "id__count" FROM "queries_item" U0 GROUP BY "queries_item"."id", "queries_item"."name", "queries_item"."created", "queries_item"."modified", "queries_item"."creator_id", "queries_item"."note_id" 7 {{{ 8 #!sql 9 SELECT (note_id) AS "note_alias", U0."id", 10 COUNT("queries_item"."id") AS "id__count" FROM "queries_item" U0 11 GROUP BY "queries_item"."id", "queries_item"."name", 12 "queries_item"."created", "queries_item"."modified", 13 "queries_item"."creator_id", "queries_item"."note_id" 14 }}} 8 15 9 16 but should (possibly) generate: 10 11 SELECT (note_id) AS "note_alias", COUNT("queries_item"."id") AS "id__count" FROM queries_item GROUP BY note_alias ORDER BY note_id 17 {{{ 18 #!sql 19 SELECT (note_id) AS "note_alias", 20 COUNT("queries_item"."id") AS "id__count" FROM queries_item 21 GROUP BY note_alias ORDER BY note_id 22 }}}