3
I have a bank in which are registered names and surname, I can group the results as follows:
SELECT DISTINCT * FROM usuarios GROUP BY sobrenome
So if you have 80 records repeated of the surname "Joseph" for example, obviously it groups and shows only 1 "Joseph", but I want to not only group the names, I want to count 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, ie the 5 most common table surnames. Is there any way to do this directly in Mysql or need to create some script in PHP?
Then it would be another SQL to bring the 5 most repeated, right?
– Ricardo
Exact! would be ideal another SQL to bring the 5 most repeated.
– Cassiano José