﻿SELECT column_name, 
--'and ('|| column_name || '= $P{'|| column_name || '} or $P{'|| column_name || ' = 0)'
case  when column_name in ('sexo', 'localidad_id', 'estatus_id', 'fecha_registro', 'dependencia_id', 'bandera', 'asigna_id')
then 
'select '|| column_name || ', count('|| column_name || ') from atencion_ciudadana_solicitud group by '|| column_name || ';'
else '' end
-- select * 
FROM information_schema.columns WHERE table_name = 'atencion_ciudadana_solicitud' 
order by 2 desc , ordinal_position asc;

