I have two tables in my database. The first one contains keywords, the other one contains longer text.
For example:
Table 1 has the following entries in a column:
word1
word2
word3
Table 2 has the following values in a column:
This entry has word1
This entry has word2
This entry has word1 and word3
This entry has word1 and word1
I want to write a query that tells me how many entries in table 2 have words from table 1 in them.
The result I am looking for is like:
word1 > 3
word2 > 1
word3 > 1
What I am currently doing is a cross join and then using like to try and get the results but it is extremely slow.
select * from (
select uk.keyword, lt.content from UniqueKeywords uk
cross join LongText) lt
where lt.content like '%'+keyword+'%'
EDIT: If you can help me give me an idea on how to do this in a PDI transformation that would be swell as well....