-- 1. ESTADÍSTICA DE POBLACIÓN (Solo 'INM')
SELECT 
    count(*) as total_inm,
    count(NULLIF(inm_ctacatastral, '')) as con_cuenta,
    count(CASE WHEN inm_ctacatastral LIKE '%-%' THEN 1 END) as con_guiones,
    count(CASE WHEN inm_ctacatastral NOT LIKE '%-%' AND inm_ctacatastral != '' THEN 1 END) as sin_guiones
FROM fdw_505.v_liq_entidad_totalxobjeto
WHERE trb_tributo = 'INM';

-- 2. MUESTRA DE FORMATOS (Solo 'INM')
SELECT 
    'INM - CON GUIONES' as categoria,
    inm_ctacatastral,
    REPLACE(inm_ctacatastral, '-', '') as limpia,
    inm_ ficha,
    trb_total_deuda
FROM fdw_505.v_liq_entidad_totalxobjeto 
WHERE trb_tributo = 'INM' AND inm_ctacatastral LIKE '%-%'
LIMIT 5;

SELECT 
    'INM - SIN GUIONES' as categoria,
    inm_ctacatastral,
    inm_ficha,
    trb_total_deuda
FROM fdw_505.v_liq_entidad_totalxobjeto 
WHERE trb_tributo = 'INM' AND inm_ctacatastral NOT LIKE '%-%' AND inm_ctacatastral != ''
LIMIT 5;
