Convert Columns To Rows

I have a table with 5 columns and 5 rows as below:

Comany      HeadcountStart      Starters      Leavers            HeatcountEnd
------      --------------                            --------      -------            ------------
AAA      500            10      5            505
BBB      180            5      0            185
CCC      225            15      5            235
DDD      50            3      0            53
EEE      200            0      5            195

I need to convert the data in the columns into rows as follows:

Company            AAA      BBB      CCC      DDD      EEE
HeadcountStart      500      180      225      50      200
Starters                           10      5      15      3      0
Leavers            5      0      5      0      5
HeadcountEnd      505      185      235      53      195

The number of rows and columns are static.

I'm using SQL 2000.

Thanks for help.
mrj1976Asked:
Who is Participating?
 
ptjcbConnect With a Mentor Commented:
http://sqlserver2000.databases.aspfaq.com/how-do-i-create-a-cross-tab-or-pivot-query.html

http://snippets.dzone.com/posts/show/2000

There are many links to walk you through how to do pivot tables using SQL 2000 t-sql.
0
 
Ashish PatelConnect With a Mentor Commented:
If the data is static then you can do this.

Select 'HeadCountStart' As Company, 500 As AAA, 180 As BBB, 225 as CCC, 50 As DDD, 200 AS EEE
Union
Select 'Starters' As Company, 10 As AAA, 5 As BBB, 15 as CCC, 3 As DDD, 0 AS EEE
Union
.....
0
 
openshacCommented:
Here's a copy of the accepted solution which said was Force Closed:

ptjcb:
http://sqlserver2000.databases.aspfaq.com/how-do-i-create-a-cross-tab-or-pivot-query.html

http://snippets.dzone.com/posts/show/2000

There are many links to walk you through how to do pivot tables using SQL 2000 t-sql.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.