select    bpp.billing_payment_plan_id,
              rh.rate_code,pi.program_name,
              pv.vendor_name,
              bpp.plan_name,
              bpp.payer_name_output,
              bpp.payer_id_output,
              bps.scheme_name,
              rh.rate_name,
              lrh.rule_name,
              ed.event_name,
              rplh.description,
              rplh.effective_date,
              rplh.end_date,
              rplh.min_units,
              rplh.max_units,
              rd.amount_charged,
              rd.from_age/12 from_age, rd.to_age/12 to_age, rd.time_chart, rd.procedure_code,
              rd.modifier1_code, rd.modifier2_code, rd.modifier3_code
from     payor_vendor pv join
              billing_payment_plan bpp on bpp.payor_vendor_id=pv.payor_vendor_id join
              billing_payment_plan_scheme_link bppsl on bpp.billing_payment_plan_id=bppsl.billing_payment_plan_id join
              billing_payment_scheme_setup bpss on bpss.billing_payment_scheme_setup_id=bppsl.billing_payment_scheme_setup_id join
              billing_payment_scheme bps on bps.billing_payment_scheme_id=bpss.billing_payment_scheme_id join
              agency_program_service_link apsl on apsl.agency_program_service_link_id=bpss.agency_program_service_link_id join
              event_definition ed on ed.event_definition_id=apsl.event_definition_id join
              agency_program_link apl on apl.agency_program_link_id=apsl.agency_program_link join
              program_info pi on pi.program_info_id=apl.program_info_id join
              rate_header rh on bppsl.rate_header_id=rh.rate_header_id left join
              la_rules_header lrh on bppsl.la_rules_header_id=lrh.la_rules_header_id join
              rate_plan_link_history rplh on rplh.rate_header_id=rh.rate_header_id join
              rate_details_view rd on rd.rate_plan_link_history_id=rplh.rate_plan_link_history_id
