mardi 16 octobre 2018

Splitting string with '+' seperator into seperate rows and apply aggregation

The data is not static and group of characters separted by + can vary. I want all the characters separated by + to be in row wise and then apply aggregation on the top of it. I am using mysql 5.7.14 in windows. suppose data is:

group   val
a+b     10
a       5
b       6
b+d+c   12
d       13
c+d     12

the output should be like:

grp_item val
a        15
b        28
c        24
d        24   

Aucun commentaire:

Enregistrer un commentaire