Transpose SQL (Pivot) columns to rows

5 pts.
Tags:
SQL
SQL Pivot
I need to pivot my records in columns into rows. Here is sample data:
create table #columnstorows
(
Payer varchar (5), ID varchar (5), ClM varchar (2), Paid1 float, Paid2 float, Paid3 float ) go
insert into #columnstorows
(Payer, ID, ClM ,Paid1, Paid2,Paid3)

select 'U001','00001','01','76.58','153.48','53.48' UNION ALL
select 'U002','00001','01','19.53','96.43','200'
 Go
select * From #columnstorows
Desired result: 
Payer1 Payer2 ID1 ID2 Paid1A Paid1B Paid2A Paid2B Paid3A Paid3B
U001   U002    001 002 76.58    19.53   153.48 96.43    53.48    200
Any help will be greatly appreciated. Thank You
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: