以下は、結果に対するOracleの選択クエリですが、不要な重複が発生しています。他の人にはなかなか見つからないと思いますので、ぜひお試しください。
SELECT I.EID EID,
I.WT Title,
I.RID RID,
I.FORMNAME STAGENAME,
I.FORMS STATUS,
I.INPT Projects,
To_char(I.DVDD, 'DD/MM/YYYY') DVDD,
CASE
WHEN B.SID = 2
AND B.DID = 2 THEN Trunc(F.EVENTDATE) - I.DVDD
ELSE NULL
END DEVLAPSEDAYS,
To_char(I.MDD, 'DD/MM/YYYY') MDD,
CASE
WHEN B.SID = 2
AND B.DID = 2 THEN Trunc(F.EVENTDATE) - I.MDD
ELSE NULL
END MONITORLAPSEDAYS,
L.LDEID LEADEID
FROM table1 I,
table2 F,
table3 B,
table4 L
WHERE I.ACTIVEFLG = 1
AND I.LATESTFLG = 1
AND I.FORMSTATUS IN ( 1, 3 )
AND I.UNIQUEID = F.UNIQUEID
AND B.SID = 2
AND B.DID IN ( 2, 3 )
AND ( F.EVENTDATE > I.DVDD
OR F.EVENTDATE > I.MDD )
AND ( ( Trunc(F.EVENTDATE) - I.DVDD ) > 2
OR ( Trunc(F.EVENTDATE) - I.MDD ) > 2 )
AND F.LINKID = B.LINKID
AND I.FORMSTAGENAME IN ( 'Develop', 'Monitor' )