Note that there are some explanatory texts on larger screens.

plurals
  1. POJoining three tables - issue with alias and Query not properly ended
    primarykey
    data
    text
    <p>I think the error description is a bit misleading, as I don't see anything wrong with the way the query is ended. I am trying to join three tables, and this is not working. Can someone point to what I'm doing wrong? This is on Oracle, by the way.</p> <pre><code>SELECT s.PITIMEDATE, ROUND(SYSDATE-s.PITIMEDATE) DIFFDAYS, s.SRC, s.VSA6, a.VSA9, c.COMMENTS, c.Actions, c.MYID FROM alarm_standing_MAU AS s INNER JOIN alarm_MAU AS a ON a.SRC = s.SRC AND a.VSA9 = (SELECT VSA9 FROM a WHERE a.SRC = s.SRC AND ROWNUM=1) INNER JOIN Alarm_Standing_Comments AS c ON c.SRC = s.SRC AND s.SRC&lt;&gt;'LastCheck' GROUP BY s.SRC, s.PITIMEDATE, s.VSA6, a.VSA9, c.Comments, c.Actions, c.MYID ORDER BY s.PITIMEDATE ASC </code></pre> <hr> <p>For more info, I was trying to add a second join to a query, but it was getting a bit unwieldy, so was experimenting with an alias. Here is the initial query - I would be interested in knowing how to improve readability via an alias.</p> <pre><code>SELECT alarm_standing_MAU.PITIMEDATE, ROUND(SYSDATE-alarm_standing_MAU.PITIMEDATE) DIFFDAYS, alarm_standing_MAU.SRC, alarm_standing_MAU.VSA6, alarm_MAU.VSA9 FROM alarm_standing_MAU INNER JOIN alarm_MAU ON alarm_MAU.SRC = alarm_standing_MAU.SRC AND alarm_MAU.VSA9 = (SELECT VSA9 FROM alarm_MAU WHERE alarm_MAU.SRC = alarm_standing_MAU.SRC AND ROWNUM=1) AND alarm_standing_MAU.SRC&lt;&gt;'LastCheck' GROUP BY alarm_standing_MAU.SRC, alarm_standing_MAU.PITIMEDATE, alarm_standing_MAU.VSA6, alarm_MAU.VSA9 ORDER BY alarm_standing_MAU.PITIMEDATE ASC </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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