Hey, I have a table setup that boils down to something like the following:
class MyUser(models.Model): type = models.IntegerField() class MyStuffs(models.Model): stuffs = models.ForeignKey(MyUser) I would like to be able to do something like: MyUser.objects.filter(mystuffs__type=1).annotate(type_one=Count('mystuffs__type')).filter(mystuffs__type=2).annotate(type_two=Count('mystuffs__type')) ie., count the number of instances of type 1 and type 2. However, this doesn't actually work, as the filters stack and I get zero records returned. Is there a way around this without using custom SQL? Adam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---