Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Aggregate data in a row-like fashion

$
0
0
I have a SQL input table that is structured like the one shown below. Based on this input table I wanna create another table that aggregates the information in a row-like fashion as shown below. How can I do this for an arbitrary amount of values?Input table:ID | Name | Value | Order1 | Tom | A | 12 | Jeff | B | 13 | Max | B | 14 | Tom | B | 2Output table:ID | Name | Val1 | Val21 | Tom | A | B2 | Jeff | B | NULL3 | Max | B | NULL

Viewing all articles
Browse latest Browse all 3145

Trending Articles