I want to convert rows to column in PostgreSQL.I want all variables against their respective id.but its not working.
Expected Output:
myvar desc fname lname sdate edate id
title1 desc1 cina jhon 1483920000000 1484524800000 14
title2 desc2 jhon lname2 1483920000000 1483910000000 16
title3 desc3 diesel zier 1483920000000 1484524800000 17
SELECT * FROM crosstab(
'SELECT name, value, id FROM test ORDER BY id') AS (
"myVar" text, "desc" text, "fname" text, "lname" text,"sdate" text,"edate" text, "value" text ,"containerid" bigint);
Error: ERROR: invalid return type SQL state: 42601 Detail: SQL rowid datatype does not match return rowid datatype.