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
try this
$ad->getcodes()->groupby('pid')->distinct()->count('pid')