Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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/



I 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/12/app-psql.html#APP-PSQL-ME...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: