I have a query that I need to construct and I'm trying to do it without a cursor, if possible.
I have a table (it's actually a view) that I need to combine multiple rows so that I can retrieve a single row of data.
My table is similar to the following:
Col1 Col2
1234 123456789
1234 987654321
1234 654987321
I need a query that will return the following:
Col1 Col2
1234 123456789,987654321,654987321
What would be the best way to go about this? I've read that cursors are bad, but I'm afraid that it might be the only way to go if I need to get the comma delimited data into a single column.
Any ideas would be appreciated.
Thanks,
Josh
I have a table (it's actually a view) that I need to combine multiple rows so that I can retrieve a single row of data.
My table is similar to the following:
Col1 Col2
1234 123456789
1234 987654321
1234 654987321
I need a query that will return the following:
Col1 Col2
1234 123456789,987654321,654987321
What would be the best way to go about this? I've read that cursors are bad, but I'm afraid that it might be the only way to go if I need to get the comma delimited data into a single column.
Any ideas would be appreciated.
Thanks,
Josh