Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to join two tables with substrings?

Jason_Li_OMG-OracleMay 10 2017 — edited May 10 2017

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

1.JPG

table B

2.JPG

table C (the table I want)

3.JPG

Could you please help? Thanks a lot!

This post has been answered by Etbin on May 10 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 7 2017
Added on May 10 2017
3 comments
2,639 views