August 17, 2009 at 1:43 am
hello,
my requirment is that i have 5 rows of data but i want to show it as clomun
ex:i have like this
rows
jack
mack
peter
scott
steve
i need this type
columns
jack mack peter scott steve
August 17, 2009 at 2:01 am
Basically, there are two ways for this common requirement:
one is the PIVOT function (see BOL = BooksOnLine, the SQL help system, for details) and the other option uses the CASE statement.
The latter can be used if the number of target columns is not static.
For details please review the following two articles by Jeff Moden:
December 28, 2009 at 2:54 am
syed_ahmedzama (8/17/2009)
hello,my requirment is that i have 5 rows of data but i want to show it as clomun
ex:i have like this
rows
jack
mack
peter
scott
steve
i need this type
columns
jack mack peter scott steve
December 28, 2009 at 6:28 am
syed_ahmedzama (8/17/2009)
hello,my requirment is that i have 5 rows of data but i want to show it as clomun
ex:i have like this
rows
jack
mack
peter
scott
steve
i need this type
columns
jack mack peter scott steve
This is a form of denormalization that should probably never be used. Why do you need to do this? What are the business rules that require this? I always ask this because there may be a better way.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply