I have a bank where names and last names are registered, I can group the results as follows:
SELECT DISTINCT * FROM usuarios GROUP BY sobrenome
So if you have 80 records repeated for the last name "Jose" for example, obviously it groups and shows only 1 "Jose", but I want to names, I want to tell which are the 5 most repeated surnames of the table, ie even having more than 30 repeated surnames for example, I want to show only the 5 most repeated ones, 5 most common surnames in the table . Is there a way to do this directly in MySQL or do I need to create some script in PHP?