Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

presenting columns as rows in sql server

Status
Not open for further replies.

rajpree

Programmer
May 24, 2005
18
0
0
US
I have data in columns ,need to present column data in rows.
I am usin SQL2000. So I can't user Pivot tables. Following is the table structure.

ID amount type amount_written
1 1000 A 500
2 5000 B 200

I need to present data following way:
1 A 1000
W 500
2 B 5000
W 200

How can I do with out using Pivot table in sql server ?
Can some has some presenting columns as rows in sql server any ideas?
 
Try this...

Code:
Select Id, Type, Amount
From   TableName

Union All

Select Id, 'W', amount_written
From   TableName

Order By Id, Type

(not tested)

-George

"the screen with the little boxes in the window." - Moron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top