views:

24

answers:

3

Hi

If I have text sotred in my DB, for example:

"There are 2 books on the table".

Maybe the user wants to search for "books" or the user wants to search in this text for any thing.

What is the best SQL Statement to do that?.

Thanks in advance.

+4  A: 
SELECT ... WHERE COL LIKE '%books%'

For more complicated scenarios you might want to investigate Full Text Search

Martin Smith
Full text search may also be better for performance since LIKE '%books%' can't use an index.
HLGEM
+2  A: 

I think you are looking for a 'like' clause if I understand your question. so

select * from table where column like '%book%'
Kevin Won
+1  A: 

like this

WHERE ColumnName LIKE '%books%'

or look into full text search if you need to do more complicated stuff

SQLMenace

related questions