Try using distinct instead of group by