数据查询BUG

浏览:384 发布日期:2016/08/29 分类:ThinkPHP5专区
如果查询数据时
model("aaa")->field("count(*) as total,id,name")->group("id")->order("total desc,id desc")->paginate(15);
此时使用分成查询就会报错,最终发现bug是在分页查询时调用count()生成的sql有问题,count生成的sql中包括了order by 导致total字段找不到,
count语句为:
select count(*) as tp_count from aaa
where xxx
GROUP BY id
ORDER BY total desc,id desc
最佳答案
评论( 相关
后面还有条评论,点击查看>>