"Ghetalion" <[EMAIL PROTECTED]> wrote:
> 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)
>
> ID TERM
> 1 a
> 2 a
> 3 f
> 4 z
> 5 a
> 6 i
> 7 i
>
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