I am having some trouble with an SQL query
the data would look something like thie
id attribute
1 blue
2 yellow
1 black
3 white
4 green
2 blue
5 green
2 brown
1 yellow
4 white
the output needs to be like this.
id attribute
1 blue,black,yellow
2 yellow, blue, brown
3 white
4 green
5 green,white
This is easy to do with cursors but it is slow. The number of record is up around 100,000 and with cursors it takes 15mins. There has to be a more efficient way of doing it.
Any suggestions
the data would look something like thie
id attribute
1 blue
2 yellow
1 black
3 white
4 green
2 blue
5 green
2 brown
1 yellow
4 white
the output needs to be like this.
id attribute
1 blue,black,yellow
2 yellow, blue, brown
3 white
4 green
5 green,white
This is easy to do with cursors but it is slow. The number of record is up around 100,000 and with cursors it takes 15mins. There has to be a more efficient way of doing it.
Any suggestions