Given a table like this:
id name field
1 walt a
2 hurley b
3 jack c
4 kate a
5 sawyer a
6 john a
7 ben b
8 miles null
9 juliet c
10 jacob d
11 richard null
How would you transfer it into this:
id ids names field
1 1,4,5,6 walt, kate, sawyer, john a
2 2,7 hurley, ben b
3 8 miles null
4 3,9 jack, juliet c
5 10 jacob d
6 11 richard null
It needs to look at all the rows having the same field value. Then it needs to "merge" all other values based on equality of the field value. However if the field value is null, it should do nothing.