On my project, the data model changed and I have to do a new request to get information but in the past it looks like all data are in the same line, but now a part of that data are in an other table, and it returns me column.
So my request returns:
I thought it was easy but i don't really understand how the function crosstab
works. I tried this:
SELECT *
FROM crosstab(
'SELECT c.cd_type as typcou, c.dt_envoi as dtenvcou, c.commentaire as comment, c.signataire as signur
FROM comm.courrier c
WHERE c.id_formalite=1
order by 1,2',
'select lf.valeur as valeur from formalite.ligne_formalite lf, formalite.formalite f where lf.fk_formalite=f.id AND lf.fk_formalite=1'
)
AS c(typcou text, dtenvcou text, comment text, signataire text, valeur1 text, valeur2 text, valeur3 text);
However, I got
ERREUR: invalid return type État SQL :42601 Détail :Query-specified return tuple has 7 columns but crosstab returns 5.
Can someone help me figure out what's wrong?