sql - MySQL: Output rows created from columns containing delimited data -


this question has answer here:

assuming have following data in mysql:

**bond** | **node** | **edges** foo      |    1     |    2,3 hak      |    2     |    1 wat      |    3     |    1,2 

i wish return results create data suitable visualisation in cytoscape. requires each node have line devoted each edge. output like:

**bond** | **node** | **edges** foo      |    1     |    2 foo      |    1     |    3 hak      |    2     |    1 wat      |    3     |    1 wat      |    3     |    2 

i think pivot operator might work somehow, have had no luck.

assuming have edge master table in possible values edges stored.

if assumption wrong, answer not hold good

select bond, node, edgemaster.edgeid mytable join edgemaster on find_in_set(edgemaster.edgeid, mytable.edges) order bond, node, edgemaster.edgeid 

sql fiddle


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -