SQL query tuning
Hi All,
Here I have a situation and trying hard to tune this query.
Version: 10.2.0.3
Here is the query:
select kyc_id, gci_number, (case when CLOSE_REQUEST_US='US' then count(gci_number) end)
from
(
select kyc_id, gci_number, (case when CLOSE_REQUEST_US ='YES' then NO else 'US' end)
from
(select distinct 'yes' from
aml_restriction AR
where ar.status='A'
and ar.is_active='Y'
and ar.location='US'
and akt.kyc_id = ar.kyc_id
union
select distinct 'yes' from
aml_closure AC
where ac.status='A'
and ac.is_active='Y'
and ac.location='US'