On Thursday 12 December 2002 20:20, Martin Hudec wrote:

> I am trying to figure out sql command for ordering results descending
> by counts of searched expressions found in result..... like this:
>
> $search="some";
>
> TEXT           | COUNTS |
> -------------------------
> Something has..|   4    |
> Some have..    |   3    |
> Some take..    |   1    |
>
> Can anyone help me please?

SELECT text, count(*) as counts FROM table_name GROUP BY text ORDER BY counts 
DESC;


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to