Pivoting Query Results in SQL: Using CASE WHEN and GROUP BY to Turn Rows into Columns | Wicked Smart Data