Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
select ID,oldid,[newid]
from table1 as adp join table2 as CLN on cln.oldid = adp.id2
or CLN.oldid = adp.ID


ID oldid newid
2 1 196
2 41 236


i need the above tables with pivoting values as below,

ID oldid newid oldid2 newid2
2 1 196 41 236

can someone help in writing the pivot query
Posted
Comments
gvprabu 25-Mar-13 7:01am    
u need to make all the row values to Column... for example If you have 10 Rows then 20 Columns for ID 2.
Anoop Jasiwal 26-Mar-13 5:58am    
but in my case i will be having only two rows ID 2
gvprabu 26-Mar-13 6:11am    
If u have only t rows means directly u ll use one temp table and Update 2nd row in that table...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900