{"ok": true, "database": "leitura", "query_name": "q_tipo_detalhe", "rows": [], "truncated": false, "columns": ["grupo", "categoria", "item", "pago", "cnpj"], "query": {"sql": "select grupo, categoria, item, pago, cnpj from (\n  select grupo_gasto as grupo, categoria_gasto as categoria,\n         case when classificacao = 'elemento' then ds_elemento_descricao else credor end as item,\n         round(sum(vl_pago),2) as pago, max(case when classificacao <> 'elemento' and cnpj_cpf like 'PESSOA JUR%' then substr(cnpj_cpf,-14) end) as cnpj,\n         row_number() over (partition by categoria_gasto order by sum(vl_pago) desc) as rn\n  from empenhos\n  where pilar = coalesce(nullif(:org,''),'prefeitura') and ano_exercicio = cast(:ano as integer) and status != 'ANULADO'\n  group by 1,2,3 having sum(vl_pago) > 0\n) where rn <= 8 order by pago desc", "params": {"ano": "", "org": ""}}, "error": null, "private": false, "allow_execute_sql": true, "query_ms": 8.451101835817099, "source": "TCE-SP, PNCP e redes do Itanha\u00e9m em Pauta"}