You could use Count(term) and GROUP BY term
like
SELECT COUNT(term) AS rank, term FROM table GROUP BY term ORDER BY rank
or something like that, and that should return something like
4, a
3, z
2, i
etc
I'm new to MySQL, but that would work in SQL Server and Oracle, depends of mysql
supports that stuff.
Travis Reeder
Chief Software Architect
ThinkVirtual
---- Original Message ----
From: Ghetalion <[EMAIL PROTECTED]>
Sent: 2001-04-04 23:33:37.0
To: [EMAIL PROTECTED]
Subject: SELECT and ORDER OPTIONS
I figure since there are various ways to sort information in SQL, there must
be some way to sort the most frequent bit of information. Example:
SELECT term FROM table ORDER BY mostfrequent(term)
And say you had this as the table
ID TERM
1 a
2 a
3 f
4 z
5 a
6 i
7 i
8 z
9 z
10 a
It would return:
a
a
a
a
z
z
z
i
i
f
It there a fuction like that availble built into MySQL?
---------------------------------------------------------------------
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
---------------------------------------------------------------------
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