esta es la consulta
Cita:
SELECT mthreport.row_name[1] as codigo,mthreport.row_name[2] as descripcion,ene,feb,mar,abr,may,jun,jul,ago,set,oc t,nov,dic
FROM
crosstab('select ARRAY[m.codlibro::text, a.descri_libro::text] as row_name,m.mes,sum(m.apertura) as estado
from mesproceso m inner join librocontable a on m.codlibro=a.codigo_libro
where m.codempresa=''01'' and m.codanio=''2010''
group by m.codlibro,a.descri_libro,m.mes
order by m.codlibro,m.mes',
'SELECT mes from mesproceso group by mes order by mes')
As mthreport(row_name text[],
ene integer, feb integer, mar integer,
abr integer, may integer, jun integer, jul integer,
ago integer, set integer, oct integer, nov integer,
dic integer);
FROM
crosstab('select ARRAY[m.codlibro::text, a.descri_libro::text] as row_name,m.mes,sum(m.apertura) as estado
from mesproceso m inner join librocontable a on m.codlibro=a.codigo_libro
where m.codempresa=''01'' and m.codanio=''2010''
group by m.codlibro,a.descri_libro,m.mes
order by m.codlibro,m.mes',
'SELECT mes from mesproceso group by mes order by mes')
As mthreport(row_name text[],
ene integer, feb integer, mar integer,
abr integer, may integer, jun integer, jul integer,
ago integer, set integer, oct integer, nov integer,
dic integer);