Подсчет дубликатов по полю в mysql

Показать какие есть совпадения

SELECT field, COUNT( field) as x FROM table_search_results GROUP BY field HAVING x >1;

Показать общее количество совпадений

SELECT count(*) AS total_count FROM (SELECT fieldFROM table_search_results GROUP BY field HAVING COUNT(field) > 1 ) AS x;

Сохранить дубликаты в файл

mysql -u root -p name_bd -e "SELECT field, COUNT( field ) as x FROM table_search_results GROUP BY field HAVING x >1" > x.txt