#28296: Add support for aggregation through subqueries
-------------------------------------+-------------------------------------
     Reporter:  László Károlyi       |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Matthew Schinckel):

 I attempted to comment in the SO post, but comments are hardly conducive
 to code blocks.

 I've written several `Subquery` subclasses to do aggregation of the
 subquery: perhaps that will work here.


 {{{
 class Count(Subquery):
     template = "(SELECT COUNT(*) FROM (%(subquery)s) _count)"

     @property
     def output_field(self):
         return models.IntegerField()
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28296#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.8e2602917ce10f05bcd32ecdfd632d4b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to