There are two tables:
Firstly, req_data
, which contains a column named req_id
.
Secondly, tc_data
which contains a column named Out-Link
. That column holds (possibly) multiple values of a possible req_data.req_id
value.
I got the following query
SELECT * FROM tc_data WHERE `Out-Link` LIKE '%//specific req_data.req_id value//%'
which returns for a specific value the results I want.I just don't know how to modify this query in order to get a result set which would look as if I would have executed the above query for every req_data.req_id
value in the req_data.req_id
column.
I tried
SELECT * FROM tc_data INNER JOIN req_data ON tc_data.`Out-Link` LIKE CONCAT('%',req_data.req_id,'%')
with no luck (takes very long to execute and does not give desired result).
Edit 1
Sample data req_data
:
req_id | *some other columns...*
-------------------------------------------------
abc_ersed_1023 | ...
-------------------------------------------------
dkd_asdf-2132 | ...
-------------------------------------------------
mcd-sad_sdf_120323 | ...
sample data tc_data
Out-Link | some other columns ...
---------------------|--------------------------
dkd_asdf-2132 |...
mcd-sad_sdf_120323 |
------------------------------------------------
mcd-sad_sdf_120323 |...
------------------------------------------------
|...
---------------------|--------------------------
abc_ersed_1023 |...
------------------------------------------------
Note that req_id's
can occur in multiple rows in tc_data
.