Link to home
Start Free TrialLog in
Avatar of tmajor99
tmajor99

asked on

SQL Select to dynamically create columns from ROW data

Is it possible to dynamically create column headers from row data using SQL?  For example; my table data looks like this:

Line              Line                                          Code       Code
Count           Name                                      Count       Name                              
37                   Pump Accessories                      37             B2C
59                    Sump Pumps                              59             B2B
2                    Supply                                        2             C2C
75                    Supply                                          75             B2C

I want to reformat this information so the code names show up as columns dynamically.  

Line Name                       B2C    B2B   C2C   Total
Pump Accessories           37                           37
Sump Pumps                              59                59
Supply                               75                   2      77
ASKER CERTIFIED SOLUTION
Avatar of Brian Crowe
Brian Crowe
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial