我需要能够对两个带注释的列的聚合进行排序
所以我想做这样的事情:
c = c.annotate(metric=Sum('results__metric'))
c = c.annotate(metric_prior=Sum('results__metric_prior'))
c = c.annotate(variance=F('metric')-F('metric_prior')) #doesn't work, for demonstrative purposes only
接着:
c = c.order_by('variance')
有谁知道如何完成类似上述的事情?