DROP VIEW LD0V0CDECISIONPDFS
;
CREATE VIEW LD0V0CDECISIONPDFS
AS 

SELECT E.BESLUTNR DECISIONID,PDF.DOKUMENTID DOCUMENTID,PDF.MALLTITEL TITLE 
FROM  LD0VYPDF PDF 
LEFT JOIN LD0V0E12 E12 ON PDF.DOKUMENTID =E12.DOKUMENTID 
INNER JOIN LD0V0E E ON  E.BESLUTNR=E12.BESLUTNR

UNION

SELECT E.BESLUTNR DECISIONID,PDF.DOKUMENTID DOCUMENTID,PDF.MALLTITEL TITLE 
FROM LD0VYPDF PDF 
INNER JOIN LD0V0E E ON  E.BESLUTNR=PDF.OBJEKTNYCKEL
WHERE PDF.OBJEKT = 'IFO.Beslut' 

UNION

SELECT E.BESLUTNR DECISIONID,PDF.DOKUMENTID DOCUMENTID,PDF.MALLTITEL TITLE 
FROM  LD0VYPDF PDF 
LEFT JOIN LD0V0E11 E11 ON PDF.OBJEKTNYCKEL =E11.BERAKNR AND PDF.OBJEKT = 'IFO.Beräkning'
INNER JOIN LD0V0E E ON  E.BESLUTNR=E11.BESLUTNR
;



