tags:

views:

35

answers:

1

Hi, I'm just wondering if it's possible to retrieve the the most entered entries from the mysql database

It's like this :

ID - Value

Id is auto increment, and value is the text that is being entered, i'd like to have it display the top 10 most entered terms, how could i do that?

+4  A: 
SELECT value, COUNT(value) as times
FROM table 
GROUP BY value ORDER BY times DESC LIMIT 0,10;
Ben
Don't forget the LIMIT 10
Jacob
alright thanks, and then if I want to display this do I do it normally with mysql_fetch_array?
Belgin Fish
Yes, and remember to reference COUNT(value) as 'times' ($myFetch['times'])
Ben