0
I’m making a query, but I am learning now. There is a way to improve the performance of this query?
select a.COD_EMPRESA, b.Dat_pagamento
from SAS_EMPRESA a
full outer join SAS_ITEM_PAGO b on (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA)
Where a.COD_GRUPO= 'BOT1' and
TO_CHAR(b.Dat_pagamento,'YYYYMM') BETWEEN 201601 AND 201711
you know the prq is using the full Outer Join ?
– Marco Souza
and what he wanted to do with (a. COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA)
– Marco Souza
TROQUE (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA) POR (a.COD_PREF_EMPRESA = b.COD_PREF_EMPRESA AND a.COD_EMPRESA = b.COD_EMPRESA)
Where a.COD_GRUPO= 'BOT1' and
– Motta
@Marconciliosouza I don’t know why I’m using this command, I searched the internet, and I did some tests, this is what returned the data I need.
– Renata Paganotti
@Marconciliosouza the code looks like this: select a., b.
from SAS_EMPRESA 
full outer join SAS_ITEM_PAGO b on (a.COD_PREF_EMPRESA || a.COD_EMPRESA = b.COD_PREF_EMPRESA || b.COD_EMPRESA)
where a.COD_GRUPO = 'BOT1' and 
TO_CHAR(b.Dat_pagamento,'YYYYMM') BETWEEN 201601 AND 201711

São duas tabelas GRANDES. In the companies have the data and in the item_pago the codes. I will return Codes and Data, in a given period. The company code is separated into two fields: COD_PREF and COD_EMPRESA, you need to find company with the combination of the two fields. You can improve the performance of this query?
– Renata Paganotti