I am trying to compile a query and within one of my joins it is necessary to make a subselect to ensure the integrity of the query as the example below:
select t01.teste
from teste t01
left join tes_teste_2 t02
on t01.isn_teste = t02.isn_teste
and t02.isn_pessoa = (select min(t04.isn_pessoa) from tes_teste t04
where t04.isn_teste = t01.isn_teste)
where t01.isn_empresa = 666
The problem that returns me that " ORA-01799: a column can not be externally attached to a subquery "
I would like some help how I could compile this subselect as a condition. Emphasizing that we use Oracle 11G.