By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,400 Members | 1,334 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,400 IT Pros & Developers. It's quick & easy.

Multi row to one row separate column also

P: 1
Now i have a MSSQL table, Material

The fields are as below,

Type, Mat_Name, Size1, Size2, Size3
A, Wood, 100, 100, 100
A, Iron, 200, 200, 200
A, Steel, 300, 300, 300
B, Plastic, 400, 400 ,400
B, Ore, 500, 500, 500
B, Glass, 600, 600, 600

Can i display them as below?

A, Wood, 100, 100, 100, Iron, 200, 200, 200, Steel, 300, 300, 300
B, Plastics, 400, 400, 400, Ore, 500, 500, 500, Glass, 600, 600, 600

Seeking help from publics, thanks
Oct 16 '13 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,430
Your thread has been moved to the SQL Server forum.

Not easily. Depending on what version of SQL Server you have, you can use XML path or you will need to use a cursor.
Oct 16 '13 #2

ck9663
Expert 2.5K+
P: 2,878
Here are some options...

Good Luck!!!


~~ CK
Oct 16 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.