hi i have a table in my database .
ShopID | ParentID | SELL
1 0 2,3
2 1 1,2,3
3 1 2,3,4
4 0 5,6
5 4 5,6,7
6 4 6,7,8
i want to add the children SELL values to the parent shop’s SELL values , but don’t want to add duplicate values ,
finally i want to have a table like this
ShopID | ParentID | SELL
1 0 1,2,3,4
2 1 1,3
3 1 2,4
4 0 5,6,7,8
5 4 5,7
6 4 6,8
is this possible with MySQL , please help . thanks in advance .
try this:
SQL FIDDLE DEMO
Update Query: