sql - MySQL: Output rows created from columns containing delimited data -
this question has answer here:
- sql split values multiple rows 4 answers
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
Comments
Post a Comment