funcion crosstab

From: Maria Antonieta Ramirez <maramirez(at)ulsaneza(dot)edu(dot)mx>
To: FORO POSTGRES <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: funcion crosstab
Date: 2017-09-11 15:38:17
Message-ID: CY4PR1801MB19271B3B23867A6B1B2DC9BAF6680@CY4PR1801MB1927.namprd18.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

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?

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Guillermo E. Villanueva 2017-09-11 15:52:48 Instalación
Previous Message Alvaro Herrera 2017-09-11 11:54:55 Re: QUERY PARA QUE ME MUESTRE LOS DATOS DE LA CONSULTA DE HORIZONTAL A VERTICAL