February 9, 2017 at 6:13 pm
Hi
I need to transform rows into columns. Besides that everytime there are two or more rows with the same sequence number the values should be placed in the respetive column.
Please see the attach file
Thanks
February 9, 2017 at 6:37 pm
littlesun - Thursday, February 9, 2017 6:13 PMHiI need to transform rows into columns. Besides that everytime there are two or more rows with the same sequence number the values should be placed in the respetive column.
Please see the attach file
Thanks
You need either a Pivot or a CROSSTAB and, IMHO, the CROSSTAB is better even though it's an ancient technique. Please see the following two links. The first teaches you how to do either and has a proof that the CROSSTAB is usually better and can be made twice as good with a thing called "pre-aggregation" (a term coined by Peter "Peso" Larsson). The second shows you how to easily build Dynamic CrossTabs.
http://www.sqlservercentral.com/articles/T-SQL/63681/
http://www.sqlservercentral.com/articles/Crosstab/65048/
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply