Hola buen dia,
Gracias a todos por responder...
Estoy revisando las doferentes opciones que me han sugerido y en el caso de la
funcion crosstab hice el ejemplo que esta en la documentación ya que lo realize
con mis tablas y me da un error. cree la misma tabla y ejecute la misma
consulta, sin embargo me da el mismo error. Ojala me puedan orientar.
CABE MENCIONAR QUE TENGO LA VERSION 9.4.1
1) CREE LA TABLA
CREATE TABLE educaciondistancia.ct(id SERIAL, rowid TEXT, attribute TEXT, value
TEXT);
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test1','att1','val1');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test1','att2','val2');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test1','att3','val3');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test1','att4','val4');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test2','att1','val5');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test2','att2','val6');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test2','att3','val7');
INSERT INTO educaciondistancia.ct(rowid, attribute, value)
VALUES('test2','att4','val8');
2) EJECUTE LA CONSULTA:
SELECT *
FROM crosstab(
'select rowid, attribute, value
from ct
where attribute = ''att2'' or attribute = ''att3''
order by 1,2')
AS ct(row_name text, category_1 text, category_2 text, category_3 text);
ME MUESTRA EL SIGUIENTE MENSAJE:
ERROR: function crosstab(unknown) does not exist
LINE 2: FROM crosstab(
^
HINT: No function matches the given name and argument types. You might need to
add explicit type casts.
********** Error **********
ERROR: function crosstab(unknown) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to
add explicit type casts.
Character: 15
¿Porque si lo hice tal cual viene en la documentacion?