How to GROUP BY in django?

44 views
Skip to first unread message

Awadhesh Meshram

unread,
Nov 3, 2016, 6:23:45 AM11/3/16
to Django users
How to GROUP BY using any identical field in database in Django?

GMail

unread,
Nov 3, 2016, 6:31:31 AM11/3/16
to django...@googlegroups.com
Hi, if you're planning to group your data after it was retrieved from database, you could use itertools.groupby(): https://docs.python.org/3/library/itertools.html#itertools.groupby

If grouping has to take place during database query, I can't help you =/

On 3 Nov 2016, at 13:15, Awadhesh Meshram <awad...@mnchost.com> wrote:

How to GROUP BY using any identical field in database in Django?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/65f54a2e-8b73-43c2-b46a-8671747f2611%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vinicius Assef

unread,
Nov 3, 2016, 7:26:38 AM11/3/16
to django...@googlegroups.com
Maybe this can help you:
https://docs.djangoproject.com/en/1.10/topics/db/aggregation/


On 3 November 2016 at 08:15, Awadhesh Meshram <awad...@mnchost.com> wrote:
> How to GROUP BY using any identical field in database in Django?
>

Melvyn Sopacua

unread,
Nov 3, 2016, 7:52:58 AM11/3/16
to django...@googlegroups.com
On Thursday 03 November 2016 03:15:31 Awadhesh Meshram wrote:
> How to GROUP BY using any identical field in database in Django?

https://www.google.com/search?q=django+group+by

Grouping is called "aggregation" in DBA lingo.
--
Melvyn Sopacua
Reply all
Reply to author
Forward
0 new messages