View: customer_payment_export_view

Columns
  Column Name Data Type
1.   fin_document_key decimal(15)
2.   fin_document_detail_key decimal(15)
3.   included_fin_document_key decimal(15)
4.   invoice_key decimal(15)
Table/Column Dependencies
Table Column
customer_payment fin_document_key
customer_payment_included_inv fin_document_key
  invoice_key
customer_payment_included_pmt fin_document_key
  included_fin_document_key
fin_document_detail fin_document_detail_key
  fin_document_key
SQL Server Create Statement
create view customer_payment_export_view as
select
   fdd.fin_document_key fin_document_key,
   fdd.fin_document_detail_key fin_document_detail_key,
   null included_fin_document_key,
   null invoice_key
from fin_document_detail fdd
join customer_payment cp on cp.fin_document_key = fdd.fin_document_key
union all
select
   fin_document_key,
   null fin_document_detail_key,
   included_fin_document_key,
   null invoice_key
from customer_payment_included_pmt
union all
select
   fin_document_key,
   null fin_document_detail_key,
   null included_fin_document_key,
   invoice_key
from customer_payment_included_inv