(Select u.bp_code From hls_bp_master u Where u.unit_id = (select v.unit_id from hls_bp_master v where v.enabled_flag = 'Y' and v.bp_id = t.bp_id) and u.bp_type = 'AGENT') bp_code,
(case when t.paid_byother_flag = 'T' and
(case when t.paid_byother_flag = 'T' and
(select v.unit_id from hls_bp_master v where v.enabled_flag = 'Y' and v.bp_category = 'AGENT' and v.bp_id = t.bp_id) = 1565
(select v.unit_id from hls_bp_master v where v.enabled_flag = 'Y' and v.bp_category = 'AGENT' and v.bp_id = t.bp_id) = 1565