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.
Author |
Topic |
harriere
Starting Member
3 Posts |
Posted - 2012-06-06 : 03:51:20
|
Hi i am new to sql programming..Let me come to the point..I am having the follwing data290780, 'LT'290780, 'AY'290781, 'ILS'290780, 'AY'i want to output that data as follows:290780 | 290781 as headingLT | ILS as valuesAY |AY |can any one pls help me to do this...i searched a lot i didnt got it...V.VIJAYhttp://harriernet.wordpress.com |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-06-06 : 04:29:28
|
select [290780] = t29780.col2, [290781] = t29781.col2from(select col2 seq = row_number() over (order by col2) from tbl where col1 = 290780) t29780full outer join (select col2 seq = row_number() over (order by col2) from tbl where col1 = 290781) t29781on t29780.seq = t29781.seq==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
|
|
|