Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to merge pivot result with othe columns

Author  Topic 

ryanlcs
Yak Posting Veteran

62 Posts

Posted - 2011-02-10 : 21:31:57
I got the following table:

Lane Bin1 Bin2 Bin3
1 B11 B21 B31
2 B21 B22 B23
3 B31 B32 B33

How can i change the layout to

Bin1(Lane1) Bin1(Lane2) Bin1(Lane3) Bin2(Lane1) Bin2(Lane2) Bin2(Lane3) Bin3(Lane1) Bin3(Lane2) Bin3(Lane3)
B11 B21 B31 B21 B22 B23 B31 B32 B33

I tried using pivot, but cant get it.

Thank You.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-10 : 23:02:33
is the number of Lane fixed ? if not you will need some form of Dynamic SQL


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -