I have a sort command to put a list of Surnames in order and unique using DISTINCT and ORDER BY. How would I get a count of quantity of each Surname listed in my database, and possibly sort in order of that or at least display that number?
SELECT Surname, COUNT(Surname) AS totSurname FROM yourtablehere GROUP BY Surname ORDER BY COUNT(Surname) DESC; PHP: