id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 17844,Propose to add generated sql queries in the doc of aggregation/annotation,peebor@…,nobody,"I'm currently trying to figure out how to write the correct and efficient query using annotation; much like the example in: https://docs.djangoproject.com/en/1.3/topics/db/aggregation/ Book.objects.annotate(num_authors=Count('authors')).order_by('num_authors') Thing is that i know the raw query i want to have but have trouble describing it with the db api; (which i do prefer over inserting raw sql using extra). It may help when the examples are extended with the generated/raw sql queries: select .... etc. ",Uncategorized,closed,Documentation,1.3,Normal,invalid,query aggregate annotate raw,,Unreviewed,0,0,0,0,0,0