有个bug要提一下

浏览:296 发布日期:2021/07/05 分类:ThinkPHP6专区 关键字: 数据库
PHP 8.0.7
mysql 5.7.34
一对多 $res=$this->where($where)->field(
            'id,client_id,deal_type,product_id,sum(price) total_price,sum(compensate_num) compensate_num_total,sum(compensate_price) compensate_price_total'
            )->group('client_id,deal_type,product_id')->select();
报错,php7.3倒是没问题,报错说是 group 因id出故障。后来我把 field id去掉就好了。

补充错误信息:[error] [10501]SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'taihao_dd.taihao_compensation_form.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by[/usr/local/nginx/html/taihaotp6/vendor/topthink/think-orm/src/db/PDOConnection.php:795]
最佳答案
评论( 相关
后面还有条评论,点击查看>>