I have the below table as a result of 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
I want to return it back to the original table. Like this:
Account Product Qty
101 A 1000
... .. ....
I think "Unpivot" can do it in MS SQL Server. But I use only PostgreSQL. What is the equivalent of Unpivot in Postgresql that can return/ungroup the above table? Thanks