0
請幫我在Django/Python中得到以下結果組由多個的Fileds和ORDER BY在Python/Django的組數
SELECT u,v,x,y,z,count(1) FROM table1 group by u,v,x,y,z order by 5,6;
請幫我在Django/Python中得到以下結果組由多個的Fileds和ORDER BY在Python/Django的組數
SELECT u,v,x,y,z,count(1) FROM table1 group by u,v,x,y,z order by 5,6;
不知道你的order by 5,6
的意思,我假設你有列這個名字......
無論如何,它應該像這樣工作:
results = MyModelForTable1.objects.values('u', 'v', 'x', 'y', 'z').annotate(Count('u')).order_by('5', '6')