Created
May 22, 2020 18:36
-
-
Save jonathanalves/982244f136dceb292346e7aa4dcbc1a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table migracao.atos_utilizados ( | |
cartorio varchar, | |
protocolo_pedido varchar, | |
pessoa_ato varchar, | |
data_utilizacao varchar, | |
retornado varchar, | |
tipo_ato varchar, | |
nome_serventuario varchar, | |
inutilizado varchar, | |
justificativa_inutilizacao varchar, | |
codigo_selo varchar, | |
codigo_ato varchar, | |
emolumento numeric, | |
fundesp numeric, | |
taxa_judiciaria numeric, | |
id_ato_isentado varchar, | |
protocolo_protesto varchar, | |
protocolo_imovel varchar, | |
ip varchar | |
) |
SELECT
cast(p.codigo as text) protocolo, p.cadastro, s.utilizacao, tipo_ato, a.codigo_ato selo, a.emolumento tj_emolumento, s.emolumentos
FROM selo_retorno_tj_go a
join selo s on s.codigo = a.codigo_ato
join protocolo p on p.id = s.protocolo_id
where s.envio between '2020-06-21 00:00:00' and '2020-06-30 23:59:59'
and s.emolumentos != a.emolumento
order by p.codigo asc
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SELECT
cast(p.codigo as text) protocolo, p.cadastro, s.utilizacao, tipo_ato, a.codigo_ato selo, a.emolumento tj_emolumento, s.emolumentos
FROM migracao.atos_utilizados a
join selo s on s.codigo = a.codigo_ato
join protocolo p on p.id = s.protocolo_id
where s.emolumentos != a.emolumento
order by p.codigo asc