A quick one here. So I read about rownum around the web and am trying to see
which way to call it is best since based on SQL Optimizer both approach shows
no difference.
select count(distinct BCC || '~' || BN) BCCN
from LINK_TBL
where AN = 'abcdefg'
and BR = 1
and rownum <= 5;
or
select count(distinct BCCN)
from (
select BCC||'~'|| BN BCCN
from LINK_TBL
where AN = 'abcdefg' and BR = '1'
)
where rownum <= 5;
The optimizer can choose to solve / reorganise your query as it sees fit, as long as it provides the right results. If you check the explain plan, you may find them identical.