[EMAIL PROTECTED] wrote:
<snip>
Try something that looks like:

SELECT searchTerms, Count(1) as frequency FROM your_table_name_here
GROUP by searchTerms
ORDER BY frequency DESC
LIMIT 10;


That will give you the 10 most frequently appearing searchTerms in the table "your_table_name_here". The GROUP BY breaks your results up by unique values (if a searchTerms value appears 3 times then the COUNT(1) will be 3 for that value), the ORDER BY ... DESC puts the highest values first, and the LIMIT 10 stops returning results after it sends you 10 rows.

IF you post your actual table definition(s), some sample data, your failed queries, and an example of what you wanted in the first place, we could give you a better answer...

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Thanks Shawn, that does exactally what I'm looking for. For my future reference, what does the COUNT(1) do? Is the '1' the number of the column I referenced first in the select statement? Like....


SELECT col_1, col_2, col_3, COUNT(2) AS count FROM....

Would that give me the count of col_2?

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

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



Reply via email to