Select COUNT(names) 'cName' FROM tblname GROUP BY names ORDER BY cName

http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html

J.R. 

-----Original Message-----
From: jakot05 [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 11, 2006 12:37 PM
To: mysql@lists.mysql.com
Subject: Results Rank

Hi!

I have a table like this

------------
names
···············
john
peter
mary
peter
john
peter
mike
mary
mary
mary
···············

I want to get a list ordered by the number of times the name appears in the
table, in the example:

mary
peter
john
mike

How I can do this?...thanks a lot for the answers

*** note: I don´t know wich are the names in the table, are changing all the
time ***


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to