Conversion_rate from gl_daily_rates to Ledger Currency
(select gld.conversion_rate from gl_daily_rates gld
where fnb.batch_date = gld.conversion_date
and gll.currency_code = gld.from_currency
and gld.conversion_type = 'Corporate'
AND (SELECT distinct(TARGET_CURRENCY_CODE) FROM GL_LEDGER_RELATIONSHIPS GLR WHERE GLR.TARGET_LEDGER_CATEGORY_CODE='SECONDARY'
AND GLR.SOURCE_LEDGER_ID = fnb.from_ledger_id and rownum = 1) = gld.to_currency) as converstion_rate