View: access_customer_view

Columns
  Column Name Data Type
1.   customer_code varchar(25)
2.   customer_key decimal(15)
3.   org_access_person_key decimal(15)
4.   legal_entity_ind varchar(1)
Table/Column Dependencies
Table Column
customer customer_code
  customer_key
org_access_hierarchy customer_key
  org_access_person_key
org_access_legal_entity customer_key
  org_access_person_key
SQL Server Create Statement
create view access_customer_view as
select c.customer_code, c.customer_key, orh.org_access_person_key, 'N' legal_entity_ind
  from customer c
       join org_access_hierarchy orh on orh.customer_key = c.customer_key
union
select c.customer_code, c.customer_key, orle.org_access_person_key, 'Y' legal_entity_ind
   from customer c
       join org_access_legal_entity orle on orle.customer_key = c.customer_key