ORA-00907: Missing right parenthesis error

Asked

Viewed 2,257 times

0

I have a select within my query used for summation and every time I add the GRID field of the PA_XCPNT_EVTHST.GRADE table, I get the ORA-00907 error. If I remove the select grid, it works perfectly. This is the original select:

( SELECT SUM( SCORE ) FROM QUIZ_DETAILS Q1 WHERE Q1.STUD_ID = QUIZ_DETAILS.STUD_ID
AND Q1.RN = '1' GROUP BY Q1.STUD_ID ) AS SOMA_SCORE

This was the select after my change (which I don’t know if is correct):

( SELECT SUM( SCORE + GRADE ) FROM QUIZ_DETAILS Q1 DADOS D1 WHERE Q1.STUD_ID = QUIZ_DETAILS.STUD_ID D1.STUD_ID = DADOS.STUD_ID
AND Q1.RN = '1' GROUP BY Q1.STUD_ID ) AS SOMA_SCORE

Can you help me??

2 answers

1

In addition to placing the AND in the second Where condition add comma between the table objects:

(SELECT SUM( SCORE + GRADE )
   FROM QUIZ_DETAILS, Q1 DADOS D1 
  WHERE Q1.STUD_ID = QUIZ_DETAILS.STUD_ID 
    AND D1.STUD_ID = DADOS.STUD_ID
    AND Q1.RN = '1' GROUP BY Q1.STUD_ID ) AS SOMA_SCORE

0

Considering that your second query is correct, I believe the mistake is that you did not put the AND between the first and the second condition of where. Try it this way:

(SELECT SUM( SCORE + GRADE )
   FROM QUIZ_DETAILS Q1 DADOS D1 
  WHERE Q1.STUD_ID = QUIZ_DETAILS.STUD_ID 
    AND D1.STUD_ID = DADOS.STUD_ID
    AND Q1.RN = '1' GROUP BY Q1.STUD_ID ) AS SOMA_SCORE
  • Inhares the error continues to occur even using AND.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.