troubleshooting Question

Pivot table for MS SQL

Avatar of Errol Farro
Errol FarroFlag for Aruba asked on
SQL
2 Comments1 Solution73 ViewsLast Modified:
I have a table as per the below

I have a table as per the below and would like to create a pivot tabe using MS SQL. Note - there are about 30 GL numbers. The attached gives a better illustration of the below

Any help is appreciated.

Field             Description
mfMpid            Customer Number
mpGlno            Gl number
mpAmount      Amount booked on G/L


Example of content of file
==========================

mfMpid      mpGlno      mpAmount
1      5      200
1      7      300
1      3      700
1      5      800
2      2      300
2      4      600
3      8      100
3      9      200
3      1      400


Expected result
===============

GL            1      2      3      4      5      7      8      9
1                  700            1000      300            
2            300            600                        
3      400                                    100      200
Capture.JPG
ASKER CERTIFIED SOLUTION
ste5an
Senior Developer

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 2 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 2 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