4 ms·
Hmm, haven't seen those a ton at work / in interviews! Would love to see some examples though if you have any. Mode's SQL tutorial uses SUM(CASE ...) and CROSS
by thomzi12 6y ago
Hmm, haven't seen those a ton at work / in interviews! Would love to see some examples though if you have any.
Mode's SQL tutorial uses SUM(CASE ...) and CROSS JOIN to mimic pivots: https://mode.com/sql-tutorial/sql-pivot-table/ https://mode.com/sql-tutorial/sql-pivot-table/
- petepete 6y agoI think they're specific to Oracle and SQL Server. It's a pity because they can be very useful. PostgreSQL can do it via the tablefunc extension and there's `\crosstabview` which is built into psql. https://www.postgresql.org/docs/current/tablefunc.html https://www.postgresql.org/docs/current/tablefunc.html https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-META-COMMANDS-CROSSTABVIEW https://www.postgresql.org/docs/12/app-psql.html#APP-PSQL-ME...