I have created view which refers table iby_ext_bank_accounts. I want to select org_id in that view but org_id is not present in iby_ext_bank_accounts table, so I tried to use iby_pmt_instr_uses_all and iby_external_payees_all (This table have Org_id) and the query is
FROM iby_external_payees_all iep
, iby_pmt_instr_uses_all ipi
, iby_ext_bank_accounts ieb
WHERE iep.ext_payee_id = ipi.ext_pmt_party_id
AND ipi.instrument_id = ieb.ext_bank_account_id
but i do not know if these conditions are right. Can someone help me in identifying if these joins are right? If these are not the correct can someone help me writting new query.
the joins are correct and u can add the condition (in bold) as in the query below:
FROM iby_pmt_instr_uses_all uses,
WHERE uses.instrument_type = 'BANKACCOUNT'
AND payee.ext_payee_id = uses.ext_pmt_party_id
AND payee.payee_party_id = :1
AND uses.instrument_id = accts.ext_bank_account_id