Group by having count 1. Функция count sql. count sql описание. select count sql. group by mysql примеры.