OK, so let's say I have table:
How can I get that result (concatinated string of all) WITH A SINGLE QUERY
Result
--------------------
A,B,C,D
I know how to do that with WHILE loop but I really need to get it with a sinle query. And I don't know weather they are 4, 5 or 100 records there.
Thanks in advance.
Code:
CREATE TABLE Test(
gui_id UNIQUEIDENTIFIER DEFAULT newid(),
vch_code VARCHAR(50)
)
INSERT INTO Test (vch_code) VALUES ('A')
INSERT INTO Test (vch_code) VALUES ('B')
INSERT INTO Test (vch_code) VALUES ('C')
INSERT INTO Test (vch_code) VALUES ('C')
How can I get that result (concatinated string of all) WITH A SINGLE QUERY
Result
--------------------
A,B,C,D
I know how to do that with WHILE loop but I really need to get it with a sinle query. And I don't know weather they are 4, 5 or 100 records there.
Thanks in advance.