【发布时间】:2020-10-08 17:48:16
【问题描述】:
作为 SUM(Case....End) 的结果,我有下表。
Account Product_A Product_B Product_C
101 1000 2000 3000
102 2000 1000 0
103 2000 1000 0
104 2000 1000 2000
我想把它放回原来的桌子。像这样:
Account Product Qty
101 A 1000
... .. ....
我认为“Unpivot”可以在 MS SQL Server 中完成。但我只使用 PostgreSQL。 Postgresql 中可以返回/取消组合上表的 Unpivot 的等价物是什么? 谢谢
【问题讨论】:
标签: sql postgresql unpivot