group by p.person_nbr, c.contact_date
pgsql-general by date:
Соглашаюсь с условиями обработки персональных данных