ORDER BY 5*(column LIKE ' term') + 4*(column LIKE ' term')

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I am trying to find some documentation on using things like ORDER BY
5*(column LIKE ' term') + 4*(column LIKE ' term')

I don't even know what it is called so it is difficult to search. My
questions is... Is the value before the * like a multiplier? So I could
give more weight to one column than another by raising that number?

I am trying to return a result that searches 5 or 6 columns and column
1 needs to have by far the most weight, 2 the second amount of weight
and so on. I thought this worked but lets say i am searching for the
word "cooking" like below

Order By 6*(book_title LIKE '%cooking"%') + 5*(book chapter LIKE
'%cooking%') + 4*(book_author LIKE '%cooking%') + 3*(book_text LIKE
'%cooking%') + 2*(book_publisher LIKE '%cooking%') +
1*(book_pulish_date) desc

The problem is if the word "cooking" is in the book_title once, but in
the book_text like 20 times, the book_text is returned first, i always
want the title to have more precedence even if it only contains
"cooking" once.

Thanks for any help.


Site Timeline