How to put sql result into single cell

0

Please login or register to vote for this query.

(click on this box to dismiss)

Webmasters

Q&A for pro webmasters

declare @t as table(productID int, packageID varchar(50));
insert into @t values
(1001, 'K1001'),
(1001, 'K1002'),
(1001, 'K1003'),
(1002, 'K1001');

    select ', ' + packageID
    from @t 
    for xml path('')

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results