select p.cod_propiedad from sce.propiedad p where matrix = 1

--***************************************
select count(*) as tot
			from sce.campo c 
			inner join sce.propiedad_valor pv on pv.cod_campo = c.cod_campo and pv.cod_propiedad = 'parent' and pv.valor = 208 
			inner join sce.propiedad_valor pv2 on pv2.cod_campo = c.cod_campo and pv2.cod_propiedad = 'file' and pv2.valor = 1 
			group by pv.valor
--*****************************************
select * from

select distinct
			c.cod_campo,nom_campo,obligatorio,obs_campo,tab.* 
			from sce.campo c 
			inner join sce.propiedad_valor pv on pv.cod_campo = c.cod_campo and cod_propiedad = 'parent' and valor =208
			inner join ( 
				select alias.* 
				from public.crosstab( 
					'select cod_campo::integer as row_mane,cod_propiedad::text as bucket,valor as bucketvalue from sce.propiedad_valor order by cod_campo,cod_propiedad' 
					,'select cod_propiedad from sce.propiedad where matrix = 1' 
					) as alias( cod_campo integer,observation integer,parent integer,percentage integer,file integer) 
			) as tab on tab.cod_campo = c.cod_campo 
			order by obs_campo 