Prev: SQL and memory usage
Next: Same Issue Here
From: Muhammad Bilal on 15 Jul 2010 16:40 Hi. Let I have a table with the following rows ERP No. Name Code 5585 John 097 5585 John 098 5585 John 701 12210 Tom 153 12210 Tom 154 I want that each erpno record is shown in a single row with the code values separated by a comma ',' as ERP No. Name Code 5585 John 097,098,701 12210 Tom 153,154 Regards, Muhammad Bilal
From: Erland Sommarskog on 15 Jul 2010 17:32 Muhammad Bilal (MuhammadBilal(a)discussions.microsoft.com) writes: > Let I have a table with the following rows > > ERP No. Name Code > 5585 John 097 > 5585 John 098 > 5585 John 701 > 12210 Tom 153 > 12210 Tom 154 > > I want that each erpno record is shown in a single row with the code > values separated by a comma �,� as > > ERP No. Name Code > 5585 John 097,098,701 > 12210 Tom 153,154 The standard reference for this problem is SQL Server MVP Anith Sen's article: http://www.projectdmx.com/tsql/rowconcatenate.aspx. -- Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|
Pages: 1 Prev: SQL and memory usage Next: Same Issue Here |