Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 merge two rows of a table into single row

Author  Topic 

bharath405
Starting Member

2 Posts

Posted - 2012-10-31 : 04:27:38
Hello,

I need a query which merge two rows of a table into single row as mentioned below

My Input is:

columns ID TEXTID L9 L7 L12 L10
L9,L7,L12,L10 1 1 A B C D
L9,L7,L12,L10 7 7 E F G H

expected output:
columns ID TEXTID L9 L7 L12 L10 L9,L7,L12,L10 1 1 A_E B_F C_G D_H


Here my column names are not fixed i.e. only first 3 column names (i.e. columns, ID, TEXTID) are fixed and remaining columns may vary.

Please suggest me a solution using SQL Query.

Best Regards,
Bharath.

K BHARATH KUMAR REDDY
   

- Advertisement -