Hey guys, can someone help me?
I need to run an extremely heavy Query and use its results in another Query. For this, I am putting it in a subquery using the clause "with". But I also need to use this result in another subquery "with". How can I do this without losing performance?
With dummy as (select id, count(*) as qtd from dual group by id),
dummy_dummy as (select dual.id, count(dummy.*) as qtd from dual, dummy where dual.id = dummy.id group by dual.id)
select dummy.qtd, dummy_dummy.qtd
from dummy, dummy_dummy
where dummy.id = dummy_dummy.id(+)