Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select 'Tempo médio de tramitação (em dias)' "Item",
- avg(case when vp.dta_abertura < '31/12/2018 23:59:59.999'::timestamp
- and (vp.dta_ultima_baixa is null or vp.dta_ultima_baixa between '01/01/2018'::timestamp and '31/12/2018 23:59:59.999'::timestamp) then
- extract(day from coalesce(vp.dta_ultima_baixa,'31/12/2018 23:59:59.999'::timestamp) - vp.dta_abertura) end)::numeric(10,2) "Ano 2018",
- avg(case when vp.dta_abertura < '31/12/2019 23:59:59.999'::timestamp
- and (vp.dta_ultima_baixa is null or vp.dta_ultima_baixa between '01/01/2019'::timestamp and '31/12/2019 23:59:59.999'::timestamp) then
- extract(day from coalesce(vp.dta_ultima_baixa,'31/12/2019 23:59:59.999'::timestamp) - vp.dta_abertura) end)::numeric(10,2) "Ano 2019",
- avg(case when vp.dta_abertura < '31/12/2020 23:59:59.999'::timestamp
- and (vp.dta_ultima_baixa is null or vp.dta_ultima_baixa between '01/01/2020'::timestamp and '31/12/2020 23:59:59.999'::timestamp) then
- extract(day from coalesce(vp.dta_ultima_baixa,'31/12/2020 23:59:59.999'::timestamp) - vp.dta_abertura) end)::numeric(10,2) "Ano 2020"
- from taxa_congestionamento.vm_processo vp
- where vp.int_vara_id_rh = 181 -- id da vara que vc (Nírondes) tá usando
- and vp.int_comarca_id_rh = 118 -- comarca de são luís
- and (vp.dta_ultima_baixa is null or dta_ultima_baixa > '01/01/2018'::timestamp) -- pegando apenas os processos que estavam tramitando no ano de 2018 prá cima
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement