This topic created in 4325 days ago, the information mentioned may be changed or developed.
有这样一组数据 :
id | topic_id | count
1 | 1 | 100
2 | 1 | 200
3 | 1 | 300
4 | 2 | 400
5 | 2 | 500
6 | 2 | 600
我的需求是根据 topic_id 进行分组,并 只 取出每个分组中 count 最大的那个。
请问该 怎么做
1 replies 2014-07-01 13:14:13 +08:00  | | 1 inyfee Jul 1, 2014 发完帖之后找出解决方法了: test = Count.objects.all() test.query.group_by = ['topic_id'] |