I am trying to perforrm conversion from sqlserver script to postgres
postgres not supporting format,unpivot and pivot function is there any alternate method to convert these to postgres
select [values],
FORMAT([1], '#,0.00') [Code 1],
FORMAT([2], '#,0.00') [Code 2],
FORMAT([3], '#,0.00') [code 3],
FORMAT((ISNULL([1], 0) + ISNULL([6], 0) + ISNULL([G], 0)),'#,0.00') [all]
from (
select ccode,
[values],
value
from abc unpivot (value for [values] in ([vq], [vq1], [vq2])) unpiv
) src pivot (max(value) for ccode in ([1], [6], [G])) piv
need to convert above code to postgres
4