Skip to content
Advertisement

sql query: if any of the columns have even one word mentioned in a given array of words, select that entire row

I have the following sql query:

select distinct * from tableName where contains ( (column1, column2, column3), 'default' )

This works fine. Instead of looking at just one keyword ‘default’ is it possible to mention an array of words and if any of the columns have even one word mentioned in that array of words, select that entire row.

Advertisement

Answer

select distinct * 
from tableName 
 where contains ( (column1, column2, column3), 'default' OR 'defalut2')

http://msdn.microsoft.com/en-us/library/aa258227%28v=sql.80%29.aspx

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement