simple query for displaying groups...
Hi all,
I'm a beginner in sqlserver2000.
I have a small question.
I have a small table as follows:
company products
------- --------
123 pencil
123 ink
123 fillers
123 cartridge
124 apple
124 orange
The objective is to display company and its products separated by commas.
123 pencil,ink,fillers,cartridge
124 apple,orange
I did it by creating a cursor by storing those two values in two temp variables and going row by row appending the characters. Since cursors are said to be slow, can this be done by select statements? I don't want to create another table for the same data this table has.
thank you for any ideas.
suraj
|