I want to combine multiple rows in a stored procedure and use this data in an ssrs report.
The example data:
CustomerId | Reference | Date | Product | Quantity
1 | 1 | 1/1/2019 | Glass | 6
1 | 1 | 1/1/2019 | Plate | 6
1 | 2 | 2/1/2019 | Glass | 1
2 | 3 | 2/1/2019 | Fork | 3
How I want to show it in the report:
CustomerId | Reference | Date | Glass | Plate | Fork
1 | 1 | 1/1/2019 | 6 | 6 | NULL
1 | 2 | 2/1/2019 | 1 | NULL | NULL
2 | 3 | 2/1/2019 | NULL | NULL | 3
I want to print a report with this data for a specific month. There are a lot of different products and not all products are used in a month. To not clutter the report, I only want to show the products that are used.
I found how to get this table with a dynamic pivot query from this question: SQL Server dynamic PIVOT query?
However, I have no idea how to get this in a report. Any help would be appreciated!