[导读]:开发了一个投票系统,需要虚拟票和真是票的总和进行排序thinkphp查询时根据两个字段的值的和进行排序$apply = M("VoteApply")->field('*,sum(votes+virtual_votes) as sumvotes')->where($where)->order('su...
开发了一个投票系统,需要虚拟票和真是票的总和进行排序
thinkphp查询时根据两个字段的值的和进行排序
$apply = M("VoteApply")->field('*,sum(votes+virtual_votes) as sumvotes')->where($where)->order('sumvotes desc')->group('id')->limit(6)->select();