Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are not linking <code>TABLE4</code> (aliased as <code>L</code>)to any of the other tables in your list thereby creating a cartesian product. This is likely generating your duplicate records. <br /> Join <code>TABLE4</code> to one of the other tables and you should be good to go. <br /></p> <p>See Cartesian Product in: <a href="http://docs.oracle.com/cd/B14117_01/server.101/b10759/queries006.htm" rel="nofollow">http://docs.oracle.com/cd/B14117_01/server.101/b10759/queries006.htm</a></p> <p>This is also a good reason for using the SQL-92 syntax over the old SQL-96. It forces you to specify your table joins explicitly. <br /> I have rewritten your query using SQL-92 you only need to insert the join condition for TABLE4 and it should work for you.</p> <p>Hope it helps...</p> <pre><code>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 INNER JOIN table2 F ON (I.UNIQUEID = F.UNIQUEID) INNER JOIN table3 B ON (F.LINKID = B.LINKID) INNER JOIN table4 L ON (&lt;insert join clause here&gt;) WHERE I.ACTIVEFLG = 1 AND I.LATESTFLG = 1 AND I.FORMSTATUS IN ( 1, 3 ) AND B.SID = 2 AND B.DID IN ( 2, 3 ) AND ( F.EVENTDATE &gt; I.DVDD OR F.EVENTDATE &gt; I.MDD ) AND ( ( Trunc(F.EVENTDATE) - I.DVDD ) &gt; 2 OR ( Trunc(F.EVENTDATE) - I.MDD ) &gt; 2 ) AND I.FORMSTAGENAME IN ( 'Develop', 'Monitor' ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload