MySQL Forums
Forum List  »  Stored Procedures

How to split delimited column and query other table using the split value.
Posted by: Satyababu Mavireddy
Date: May 09, 2015 02:33AM

I am new to MYSQL, I am looking for ideas and if possible code block for my requirement below.
I need to split the values mentioned in ‘T2_IDs ‘in T1, and query T2 for each T2_Id produce the result set
I have googled and read through MY SQL documentation for appropriate functions, it seems there is no such function which can be used to convert delimited column value into list, so that it can be used with IN ()
I have tried some of the function posted in blogs, they all working but not fetching the results as required.
Table 1: T1

Id T2_ids

1 10;11
2 11;12;10


Table2 :T2

Id title

10 Abcd
11 Edf
12 Def

Expected Output:

Id title

1 Abcd
1 Edf
2 Edf
2 Def
2 Abcd

Any help is much appreciated.

Options: ReplyQuote


Subject
Views
Written By
Posted
How to split delimited column and query other table using the split value.
2771
May 09, 2015 02:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.