3 ms·
I'm guessing you're referring to this - https://stackoverflow.com/questions/6795202/django-count-in-multiple-annotations https://stackoverflow.com/questions/679
by lozenge 9y ago
I'm guessing you're referring to this - https://stackoverflow.com/questions/6795202/django-count-in-multiple-annotations https://stackoverflow.com/questions/6795202/django-count-in-...
Another solution not mentioned in the link is the `Subquery()` expressions added in Django 1.11. A lot of databases will optimise those just as well as the `SELECT ..., COUNT() FROM ..JOIN..` that you would write by hand.