#812

Build an Excel-style table: products as rows, months as columns

The CFO is used to an Excel-style grid: product in rows, months in columns, sum in the cell. Your data is in «long» form — every row in sales is «product, month, amount». Pivot it into «wide» form: for every product compute total sales separately for January 2024, February 2024, and March 2024. Show the product and three columns with the per-month sums. Sort by product.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

productm_2024_01m_2024_02m_2024_03
A100.00150.00120.00
B80.0090.00110.00
C60.0070.0085.00

Your query result will appear here