troubleshooting Question

SQL 2000 Query; How to Pivot Data?

Avatar of granate
granate asked on
Microsoft SQL Server
6 Comments1 Solution303 ViewsLast Modified:
Hi;

I have an SQL Server 2000 database table that I would like to query, but re-arrange the queried data into a recordset of a differnent layout.  

Current Database Layout with Data
Date            Yr_Num            Price
----------------------------------------------------------
01/01/2004      1            94.18
01/01/2004      2            92.11
01/01/2004      3            91.34
01/01/2004      4            90.09
01/01/2004      5            99.34
01/02/2004      1            97.49
01/02/2004      2            94.34
01/02/2004      3            95.78
01/02/2004      4            94.34
01/02/2004      5            94.66
01/03/2004      1            94.55
01/03/2004      2            94.24
01/03/2004      3            95.78
01/03/2004      4            94.34
01/03/2004      5            94.67


Desired Recordset via Query

Date             1        2          3        4          5
01/01/2004    94.18   92.11   91.34   90.09   99.34
01/02/2004    97.49   94.34   95.78   94.34   94.66
01/03/2004    94.55   94.24   95.78   94.34   94.67

Your help is greatly appreciated.  
ASKER CERTIFIED SOLUTION
JimV_ATL

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros