how to count how many records of a column are in your database and sort by the count
Use the select query below will produce a count on each variation in the field you require.
Simply change the fieldname to be your fieldname in the database and the tablename to the the name of the table
SELECT fieldname , COUNT( * ) AS counta FROM tablename GROUP BY fieldname ORDER BY counta DESC
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
|