Adding group by in the pulled sentence