I have two tables, lets call it table A and table B. They looks like:
A.col1 A.colX B.colY
1 123 123
2 234, 123 234
3 2, 52352 2
52352
What I have to do is to JOIN
them, most probably using WHERE
, because non-equi join is not supported in my environment. I have the problem with table A
, where numbers are as string. I tried solution with:
SELECT...
FROM A, B
WHERE A.colX LIKE concat('%', B.colY, '%')
but it doesn't work correctly as for example value 2
from B.colY
appears in every string from table A.colX
.
At the end example what i want to achieve:
output
1 123 -------> 123
2 234, 123 --> 234
1 234, 123 --> 123
3 2, 52352 --> 2
3 2, 52352 --> 52352
Do you have any ideas for that ?