tags:

views:

34

answers:

1

I would basically like to do the same as this question, but grouping by combinations of two values, rather than just one:

SELECT player_type, team, COUNT(*) FROM players GROUP BY player_type, team;

Does anyone know whether, and how, this is possible in Django? I'm using 1.2.

+1  A: 
Player.objects.values('player_type', 'team').order_by().annotate(Count('player_type'), Count('team'))
Amarghosh