I have a query which generates the following result. However I need to again restructure the format. I tried using Convert rows into columns sql server but got an error (cannot create row greater than the allowed..). I am not that good in SQL queries. Please kindly help me on this.
Datasource  AcctCode    Amount
AB01        100         20,000.00
AB01        101         228.00
AB01        102         5,000.00
AB01        103         10,000.00
AB02        100         540,000.00
AB02        104         305,000.00
AB02        105         21,330.00
AB02        106         10,000.00
AB03        100         1,000.00
AB03        101         54,000.00
AB03        105         30,500.00
AB03        106         40,000.00
AB03        107         5,000.00
Expecting this.
Accout  AB01        AB02           AB03          Total
100    20,000.00    540,000.00     1,000.00      561,000.00
101    228.00           -          54,000.00     54,228.00
102    5,000.00         -              -         5,000.00
103    10,000.00        -              -         10,000.00
104        -        305,000.00         -         305,000.00
105        -        21,330.00      30,500.00     51,830.00
106        -        10,000.00      40,000.00     50,000.00
107        -            -          5,000.00      5,000.00
 
    