August 27, 2008 at 12:29 am
hi, my table contain the following values
no name
1 aaa
1 bbb
1 ccc
2 vvv
2 nnn
i need output as following ( max no.of cols is 5 )
no col1 col2 col3 col4 col5
1 aaa bbb ccc null null
2 vvv nnn null null null
please give me some inputs.
August 27, 2008 at 2:32 pm
Not quite sure I follow the question exactly. What are the business requirements?
This looks like it may be using the PIVOT operator but not sure.
August 27, 2008 at 2:42 pm
Read this article by Jeff Moden it will teach you how to do what you want.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
By Jeff Moden, 2008/08/19
August 28, 2008 at 12:59 am
Duplicate post, see http://www.sqlservercentral.com/Forums/Topic559341-338-1.aspx
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply