We tried to transposing of data using unpivot operator in sql server 2012.same thing we have to output using postgres database. so,we have to rewrite given syntax into postgresql.
We have also tried on postgresql : uncrosstab() function using given query structure.
select * from uncrosstab( select * from tablename) as ct()
ie Our input sql server 2012 syntax is :
select Name,budget,CASE WHEN bmon='BudMnt1' THEN CONVERT(DATE, '01-JAN-2015')
WHEN bmon='BudMnt2' THEN CONVERT(DATE, '01-FEB-2015')
WHEN bmon='BudMnt3' THEN CONVERT(DATE, '01-MAR-2015')
WHEN bmon='BudMnt4' THEN CONVERT(DATE, '01-APR-2015')
WHEN bmon='BudMnt5' THEN CONVERT(DATE, '01-MAY-2015')
WHEN bmon='BudMnt6' THEN CONVERT(DATE, '01-JUN-2015')
WHEN bmon='BudMnt7' THEN CONVERT(DATE, '01-JUL-2015')
WHEN bmon='BudMnt8' THEN CONVERT(DATE, '01-AUG-2015')
WHEN bmon='BudMnt9' THEN CONVERT(DATE, '01-SEP-2015')
WHEN bmon='BudMnt10' THEN CONVERT(DATE, '01-OCT-2015')
WHEN bmon='BudMnt11' THEN CONVERT(DATE, '01-NOV-2015')
WHEN bmon='BudMnt12' THEN CONVERT(DATE, '01-DEC-2015')
END AS bmon from tablename
UNPIVOT
(
budget
FOR bmon IN (BudMnt1,
BudMnt2,
BudMnt3,
BudMnt4,
BudMnt5,
BudMnt6,
BudMnt7,
BudMnt8,
BudMnt9,
BudMnt10,
BudMnt11,
BudMnt12)
) p
Any help would be much appreciated ?