发现一个数据库查询语句的bug 都来看看

浏览:551 发布日期:2017/08/03 分类:ThinkPHP5专区 关键字: bug 求解
只是一个查询算平均数,保留1位小数,没有值就是0的查询,单条查询没有错,一旦多了就丢失了参数了!!->where('fa_id',$faId)
            ->field('COALESCE(FORMAT(AVG(score),1),0) as all_score,
                           COALESCE(FORMAT(AVG(score_major),1),0) as major_score,
                           COALESCE(FORMAT(AVG(score_attitude),1),0) as attitude_score,
                           COALESCE(FORMAT(AVG(score_experience),1),0) as experience_score')
查看语句就变成了SELECT COALESCE(FORMAT(AVG(score),1),0) as all_score,
 COALESCE(FORMAT(AVG(score_major),0) as major_score,
 COALESCE(FORMAT(AVG(score_attitude),0) as attitude_score,
 COALESCE(FORMAT(AVG(score_experience),0) as experience_score 
最佳答案
评论( 相关
后面还有条评论,点击查看>>