Laravel Eloquent - distinct() and count() not working properly together

前端 未结 12 1143
甜味超标
甜味超标 2020-12-04 15:54

So I\'m trying to get the number of distinct pids on a query, but the returned value is wrong.

This is what I try to do:

$ad->getcodes()->group         


        
12条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 16:33

    try this

    $ad->getcodes()->groupby('pid')->distinct()->count('pid')
    

提交回复
热议问题