Hacker News new | ask | show | jobs
by karkisuni 2781 days ago
I wish there was something like this in postgres. tablefunc is a lot more complicated than this syntax.
3 comments

There are a couple ways to pivot in postgres, here is one that uses json functionality https://gist.github.com/ryanguill/101a19fb6ae6dfb26a01396c53...
I would like something with simple functionality, where I can just specify the table name, the category column, and the data column and get a new table transposed ibto columns. I would be happy to do the aggregation outside the pivot process. PROC TRANSPOSE in SAS would be a good model.
Dynamic row to column pivotation/transpose in Postgres made simple.

https://github.com/hnsl/colpivot