Searching a keyword in a long string in mysql?
Posted
by user187580
on Stack Overflow
See other posts from Stack Overflow
or by user187580
Published on 2010-04-20T17:14:09Z
Indexed on
2010/04/20
17:33 UTC
Read the original article
Hit count: 228
Hello
keyword = house
SELECT * FROM products WHERE description LIKE '%house%'
This query also returns records having keyword, for example, courthouse, but I want to look for house only. How do I search anywhere in the description for "house" only?
Thanks.
UPDATE
just for more clarification ..
actually house, can be at
- the start of the description .. "House for sale..",
- can be quoted -- "house", 'house'
- can have exclamation .. house!!!, house!
- others - house? etc ..
this is why I used %house%
© Stack Overflow or respective owner