SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Transpose of rows to columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 07/08/2005 :  10:34:45  Show Profile  Reply with Quote
Guys,
I need to transpose my rows to columns.
This is my scenario with sample data

srcdata subid srcdata2 srcdata3
____________________________________________
1000002 1
2000003 2
3000020 3
1000030 1
2000009 2
3000021 3

I want to populate columns srcdata2 and srcdata3 whenever subid = 1 with the values of srcdata
when subid = 2 and 3 respectively

srcdata subid srcdata2 srcdata3
____________________________________________
1000002 1 2000003 3000020
2000003 2
3000020 3
1000030 1 2000009 3000021
2000009 2
3000021 3

Any suggestions/inputs would be very helpful indeed

Thanks

madhivanan
Premature Yak Congratulator

India
22761 Posts

Posted - 07/08/2005 :  10:42:29  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
This may help you
http://sqlteam.com/searchresults.asp?SearchTerms=pivot

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.08 seconds. Powered By: Snitz Forums 2000