re: order results by count of searched expression

2002-12-14 Thread Victoria Reznichenko
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




order results by count of searched expression

2002-12-12 Thread Martin Hudec
Hello mysql,

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?

-- 
Best regards,
 Martin  mail   [EMAIL PROTECTED]
 mobile +421.907.303.393
 icq34358414
 wwwhttp://www.corwin.sk

PGP key fingerprint  21365ca05ecfd8aeb1cf19c838fff033

In those days spirits were brave, the stakes were high, 
 men were real men, women were real women and small furry 
 creatures from Alpha Centauri were real small furry creatures 
 from Alpha Centauri.

by Douglas Adams


-
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