Tags / unpivot
Converting Columns to Rows Using SQL Server's CROSS APPLY and VALUES Function
Constructing a New Table by Aggregating Values in One Table: A Comprehensive Guide to Calculating Purchase Rates
Using SQL and UNION ALL to Aggregate Data from Multiple Columns
Unpivoting Multiple Rows: A Comprehensive Guide to Transforming Rows into Columns in SQL Server