You can use a query like this one

SELECT string, COUNT(string) as co FROM searchstat GROUP BY string order by co 
DESC;

HTH 

-- 
Dobromir Velev
[EMAIL PROTECTED]
http://www.websitepulse.com/

On Friday 27 August 2004 16:03, Dialogcentret wrote:
> Example: I have a search box on my webpage and all searchstring are saved
> in a database.
>
> $foresp = mysql_query("SELECT string, COUNT(string) FROM searchstat GROUP
> BY string ",$db);
>
> while ($data = mysql_fetch_array($foresp)) {
>  echo "<br>($data[1]) " . str_replace('<', '&lt;', $data[string]) . " ";
> }
>
> However, I would like to write the result out with the most popular search
> strings first. Is it possible to sort the output by count(field_name) ?
>
>
>
> Med venlig hilsen
> Birger Langkjer
> Dialogcentret



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

Reply via email to