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
The following should work
$ad->getcodes()->distinct('pid')->count('pid');