#reporting Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
SQL ROLLUP — Subtotals and Grand Totals
`GROUP BY ROLLUP` adds subtotal rows (with NULL for the rolled-up columns) plus a grand total. Drop into reports without writing UNIONs by hand.
SQL Pivot Without PIVOT (Conditional Aggregation)
Most databases don't have a real `PIVOT` keyword (SQL Server does). The portable answer is conditional aggregation — `SUM(CASE WHEN ...) AS col` for each pivoted value.