troubleshooting Question

T-SQL Query question

Avatar of daforga
daforga asked on
Microsoft SQL Server 2005
5 Comments1 Solution237 ViewsLast Modified:
I have a table, MatrixRates.  The following select statement returns 50 rows containig 5 columns.  
Selectdaysoutstanding,purchases,netrate from matrixrates
where ratecode = '0.9 0 100' order by daysoutstanding

10      0      6.90
10      10      3.90
10      25      2.90
10      50      1.90
10      100      1.80
20      0      7.80
20      10      4.80
20      25      3.80
20      50      2.80
20      100      1.80
30      0      8.70
30      10      5.70
30      25      4.70
30      50      3.70
30      100      2.70
40      0      9.00
40      10      6.60
40      25      5.60
40      50      4.60
40      100      3.60
50      0      9.0
50      10      7.50
50      25      6.50
50      50      5.50
50      100      4.50
60      0      9.0
60      10      8.40
60      25      7.40
60      50      6.40
60      100      5.40
70      0      9.0
70      10      9.0
70      25      8.30
70      50      7.30
70      100      6.30
80      0      9.0
80      10      9.0
80      25      9.00
80      50      8.20
80      100      7.20
90      0      9.0
90      10      9.0
90      25      9.0
90      50      9.00
90      100      8.10
100      0      9.0
100      10      9.0
100      50      9.0
100      100      9.00
100      25      9.0


Is there any way to present this data in a table of 10 rows, reflecting the 10 distinct daysoutstanding by 5

columns containing netrate data ,reflecting the 5 distinct purchases the netrate.

example:

          0     10    25    50   100  
10   6.90 3.90 2.90 1.90 1.80
20   7.80 4.80 3.80 2.80 1.80
30   8.70 5.70 4.70 3.70 2.70
40   9.00 6.60 5.60 4.60 3.60
50    9.00 7.50 6.50 5.50 4.50
60    9.00 8.40 7.40 6.40 5.40
70    9.00 9.00 8.30 7.30 6.30
80    9.00 9.00 9.00 8.20 7.20
90    9.00 9.00 9.00 9.00 8.10
100  9.00 9.00 9.00 9.00 9.00

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
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 5 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