select ifnull(min(true), false) asv from dual WHERE exists (select 1 from xEpic_Episode3 e JOIN xIntegration_Mapping4 i ON i.fromValue1 = e.hospitalCode and i.toValue1 = 'NoRowHasThisValueInToValue1' where e.cpr = '1234567890');