$coupon->whereIn('id',$res1['coupon_id'])->where('status',2)->get();
//怎么根据merchant_id 来去重
我尝试了
$coupon->whereIn('id',$res1['coupon_id'])->where('status',2)->groupBy('merchant_id')->get();
结果是
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'run.pq_coupon.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select * from pq_coupon
where pq_coupon
.deleted_at
is null group by merchant_id
)
编辑
config/database.php
第53行strict
的值改成false
,我的是5.5的在53行,你看下你的在第几行,['connections']['mysql']['strict']
, 路径是这样的