Database · Medium
How do you pivot rows to columns using conditional aggregation in SQL?
DatabaseSQLFresher
Answer preview
Pivoting turns rows into columns: one output row per group, with one column per distinct value of some category. The portable way is conditional aggregation — GROUP BY the row key, then wrap each column in CASE or the SQL-standard FILTER clause.…