A handy trick to add some sort of ranking to SQL search results:

Creating some sort of search functionality is something we all have to do at one point or another. For the good cases, we have fulltext search or an external program available to us. But sometimes, getting down and dirty with plain SQL is the only option.

SUM(((LENGTH(Body) - LENGTH(REPLACE(Body, 'term', '')))/4))
AS Occurrences

Particletree: Ranked Searches with SQL