找了一圈group by的东西。没有解决我的需求: 问题: select id,max(price) ,groupid from table where vote>1 group by groupid 如果使用 .objects.filter(条件).value(price).annatate(max(price)) 的方法, 那么id 和 groupid 这两个字段,无法显示。 有什么好的方法么?
我以前写过这样的东西,不知道能不能用上
subject_category_raws = Discovery.objects.values( 'subject', 'subject__name', 'category', 'category__name').order_by( 'subject', 'category').annotate(ccount=Count('category'))