How to flatten a table using SQL Server? -
i'm using sql server 2012. project want flatten table, need help. table. | applicationname | name | value | createdon | contoso | description | example website | 04-04-2014 | contoso | description | nothing | 02-04-2014 | contoso | keywords | contoso, about, company | 04-04-2014 | contoso | keywords | contoso, company | 02-04-2014 i want last modification record name application name. result want. | applicationname | description | keywords | contoso | example website | contoso, about, company i don't temp tables. knows how this? thanks lot. jordy here's more complete solution: declare @collist nvarchar(max) set @collist = stuff((select distinct ',' + quotename(name) table -- table here xml path(''), type ).value('.', 'nvarchar(max)') ,1,1,'') ...