Hi

I'm trying to do some sorting by relevance on a query. Essentially, i'd like
to know if there is way to order the results by number of rows returned or
if this is the best i can get and do the rest within PHP?

mysql> SELECT web_account, code_short FROM lookup WHERE code_short IN ('U',
'S', 'G');

+-------------+------------+
| web_account | code_short |
+-------------+------------+
| A007        | U          |
| A007        | S          |
| J009        | G          |
| J009        | U          |
| J009        | S          |
| B001        | U          |
+-------------+------------+
6 rows in set (0.00 sec)

I'd like to order these so that "J009" would be grouped at the top of the
set because it was found in 3 rows, "A007" would be placed after "J009" with
"B001" last.

Any ideas :) ?

Thanks for your time.



Girish


---------------------------------------------------------------------
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