I would like to query columns product_id,contact from table A and column tags from table B. And I can't change the definition of these two tables. Column tags contains several strings for different marks. For example, a cell in tags could be 'productA_id:21,reless' or 'ersfd,productC_id:43 reless'. So in this long string different marks are separated by ',' or ' '. In my example, product A and mark 'reless' is separated by ',' and product C and mark 'reless' is separated by ' '.
What I want to do is to join these two tables on product_id in table A equals product_id in the tags of table B.
Here are an example about my question.
table A

table B

table C (the table I want)

Could you please help? Thanks a lot!