I received a request to export data from my asp.net mvc project using linq to an excel spreadsheet. Usually this is an easy task, however, in this scenario the person requesting the data would like the export from example or list A to look like example B
Example A (current export)
Id | CustomerNum | CustomerName | FruitName | Charge
____________________________________________________
1 | 1026 | Bob | Banana | 3.00
2 | 1032 | Jill | Apple | 2.00
3 | 1026 | Bob | Apple | 3.00
4 | 1144 | Marvin | Banana | 1.00
5 | 1753 | Sam | Pear | 4.00
6 | 1026 | Bob | Banana | 3.00
Example B (requested export format)
Id | CustomerNum | CustomerName | Banana | Apple | Pear
_________________________________________________________
1 | 1026 | Bob | 6.00 | 3.00 |
2 | 1032 | Jill | 0 | 2.00 |
3 | 1144 | Marvin | 1.00 | 0 |
5 | 1753 | Sam | 0 | 0 | 4.00
I have never seen where distinct row values were used as columns. How should I go about this?