Reputation: 1
Please help me in getting the result of below in django/python
SELECT u,v,x,y,z,count(1) FROM table1 group by u,v,x,y,z order by 5,6;
Upvotes: 0
Views: 532
Reputation: 16673
Not sure what you mean by order by 5,6
, I assume you have columns with that name...
Anyway, it should work like this:
results = MyModelForTable1.objects.values('u', 'v', 'x', 'y', 'z').annotate(Count('u')).order_by('5', '6')
Upvotes: 1