Skip to content
Advertisement

how to split one row to many based on a comma separate column

here is my data in mysql table:

I want to get data as the below format. So I can use it to join another tables.

Advertisement

Answer

This is a very bad format, as no doubt comments and other answers will tell you. You want a junction table — and this is perhaps why you want this query.

The simplest way is if you have a table of all valid child ids. Then you can do:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement