Hi everybody.
I'm trying to formulate a query for a keyword search engine.
I have the following query:
PHP Code:
SELECT title FROM books WHERE UPPER(description) LIKE '%LOSE%';
description is varchar(10000)
This query will return all books with the description containing words such as:
1) closely
2) loser
etc.
This is the behavior I would expect. But now I want to take it to the next level. Basically, I want to find only the literal instances of the word LOSE. Not just all instances of the character string within any string.
I'd like to find only the word LOSE, when it is:
1) Surrounded by whitespace, or
2) surrounded by the any of the following characters: !~@#$%^&*()-+=/?<>"':;,.`\|[]{}_
I've tried using IN or = instead of LIKE, but no luck. I also removed the % wildcard but still no luck. These all come up with no results found.
I've also tried:
PHP Code:
SELECT title FROM books WHERE UPPER(description) LIKE '_LOSE_';
and just
PHP Code:
SELECT title FROM books WHERE UPPER(description) LIKE 'LOSE';
Do I need to do some stuff with PHP before sending the query word to the database? I am thinking because this is a long varchar(10000), that's why I can't figure it out.
Hmmm....any ideas?
Thanks,
Ted