1

I have two columns in two different tables. They can both contain data thats similar. For example column what would have stack and column 2 would have stack overflow in. The data varies from line to line though, What i want to do is do a LIKE to return only the rows that match so if each one has the same word in (even if there are other words) then it returns the value. I I've tried a few like's with % but cant seem to get it?

GPH
  • 1,817
  • 3
  • 29
  • 50

1 Answers1

0

Not knowing much about sql-server, so i won't be able to write down a code, but i think this steps would help you solvle the problem.

You need to split the values to words in both tables, you might need to a create a function for that purpose. This link might help you with that T-SQL split string

Then join the tables, and write down a filtering statement of where clause saying;

t1.words in (t2.words) or t2.words in (t1.words)

SOME|ANY keywords might help you with that.

Community
  • 1
  • 1
Bren
  • 2,148
  • 1
  • 27
  • 45