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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need values of cells as column header
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

3 Posts

Posted - 06/06/2012 :  03:51:20  Show Profile  Reply with Quote
Hi i am new to sql programming..

Let me come to the point..
I am having the follwing data

290780, 'LT'
290780, 'AY'
290781, 'ILS'
290780, 'AY'

i want to output that data as follows:

290780 | 290781 as heading
LT | ILS as values
AY |
AY |

can any one pls help me to do this...i searched a lot i didnt got it...


Flowing Fount of Yak Knowledge

United Kingdom
3385 Posts

Posted - 06/06/2012 :  04:29:28  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
select [290780] = t29780.col2, [290781] = t29781.col2
(select col2 seq = row_number() over (order by col2) from tbl where col1 = 290780) t29780
full outer join
(select col2 seq = row_number() over (order by col2) from tbl where col1 = 290781) t29781
on 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.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000