I have a table with multiple words, from 1 to n.
declare @words table
(
word varchar(100) not null
)
insert into @words (word) values ('word1')
insert into @words (word) values ('word2')
insert into @words (word) values ('word3')
declare @tablea table
(
column1 varchar(100) not null
)
insert into @tablea (column1) values ('aword1a aword2a aword3a')
insert into @tablea (column1) values ('word2a')
insert into @tablea (column1) values ('word3a')
Im having trouble to write a query to select from a table where a column is like these words, and I need the AND operator. If the table contains word1, word2, word3, the like clause must match the three words, it means, I want to return the first row in tablea.
select *
from tablea
where
column1 like ?