> is there a way to sort the results of a ".. LIKE" query by hits?

i'm sorry i have
1. misunderstood the effect of LIKE
2. posted a question easy to get wrong

so, what i need to know is:

how can i sort the results of "SELECT * FROM foo WHERE bar LIKE
'%searchterm%'" or a similar search query by their "likeness" or by accuracy, or by
the number of occurence, in order to have the "best" search results on top?

i.e. table 'foo':

bar
---------------------------
'bar'
'have you seen the foo?'
'foo'
'tomatoes are delicious'
'the foo is a foo is a foo'

"SELECT bar FROM foo WHERE bar LIKE '%foo%'" should return something like
the order

bar
---------------------------
'foo' (exact match)
'the foo is a foo is a foo' (3 matches)
'have you seen the foo?' (1 match)


-- 
Sent through GMX FreeMail - http://www.gmx.net


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to