SQLTeam.com | Weblogs | Forums

How to exclude words when searching


#1

Hello guys!
I am new here, I hope you are all well.
I have a question and hopefully you will be able to help me.

So basically, we have a database at work which is a sql database as far as I am concerned. When I try to search something, I usually use the % sign, in order to search for a word in the database.
For example, when I type %apple, it will show all items with the word apple. But, how is it possible to exclude a word from that search?
For example, if i get a result apple ipad, how can i exclude the word ipad, and just show me the rest of the results?

Thanks a lot!


#2

column LIKE '%apple%' AND column NOT LIKE '%ipad%'


#3

Hi Scott,

Thank you for your response. I am afraid that does not work. There is just one column in that database, and all I can do is just search for words in that empty box. If I type '%apple', it shows all items with the word apple. If for example I type 'apple' (without the '%'), it will show all items that begin with 'apple'.
Is there a way to exclude a word from that search, using another sign or something?

Best regards


#4

select replace(column_name, 'Apple ', '') from table_name;


#5

what ScottPletcher gave you is the answer. do you have the query that does the search? and what is this box you talk about, is it a search box?