Customer Table -------------- ID Name 1 James 2 Peter
Order Table --------------- OrderId CustId 100 1 101 1 102 2
How can I w
Adding full details from Sheikh Haris' link.
Given this table:

To get output like:

Use the following SQL:
SELECT field1,
Substring(convert(varchar(100),
(
SELECT (', ' + field2)
FROM #test t2
WHERE t1.field1 = t2.field1
ORDER BY field1, field2
FOR XML PATH( '' )
)), 3, 1000 )
FROM #test t1
GROUP BY field1
I added a convert function to the substring so that the WIDEMEMO field would be displayed (SQL Server)