CREATE OR REPLACE FORCE VIEW "V_PPMS_DT080" ("PORTFOLIO", "PROJEKT", "JAHR") AS 
WITH dt080 AS
(SELECT
DI023041 AS PORTFOLIO, 
DI023101 AS PROJEKT, 
DI023053 AS JAHR
FROM     
 DT859 INNER JOIN DT858 ON (DT859.DI023041 = DT858.DI023102)
UNION
SELECT
DI023102 AS PORTFOLIO, 
DI023119 AS PROJEKT, 
DI023062 AS JAHR
FROM     
 DT858 INNER JOIN DT861 ON (DT858.DI023101  = DT861.DI023119)
)     
SELECT 
PORTFOLIO,
PROJEKT,
JAHR
FROM dt080
INNER JOIN DT870 ON (DT080.PORTFOLIO = DT870.di028667)
INNER JOIN DT461 ON (DT080.PROJEKT  = DT461.di001001)  
LEFT OUTER  JOIN DT859 ON (DT080.PORTFOLIO = DT859.di023041 AND DT080.JAHR = DT859.di023053) 
LEFT OUTER  JOIN DT808 ON (DT461.di007786 = DT808.di007025)   
LEFT OUTER  JOIN DT861 ON (DT080.PROJEKT  = DT861.DI023119 AND DT080.JAHR = DT861.DI023062)

;/
