 <p>considered two tables hist and fund. And required query will be:</p> <pre><code>select * from fund f, hist h where f.FUND_ID=h.FUND_ID and f.fund_id is not null and f.FUND_ID not in (select nvl(REPLACEMENT_FUND_ID,'0') from fund) and h.OLD_STATUS is null and h.NEW_STATUS='I'; </code></pre>