0

I am running following query in Oracle 10 XE and getting [Err] ORA-00904: "Q": invalid identifier

SELECT questions.sb_title Q,questions.sb_baab_id,questions.sb_fasal_id,QUESTIONS.SB_CONTENT answer,IST.SB_PREFERENCE PREF
FROM USER_QUESTIONS questions
INNER JOIN USER
ON QUESTIONS.SB_USER_ID = USER.SB_ID
INNER JOIN IST 
ON IST.SB_ID = USER.SB_IST_ID
AND(Q  LIKE '%where is%') 
AND USER.SB_IST_ID = 
(
    Select issued.SB_IST_ID
    FROM USER_REGISTER register_number
    INNER JOIN USER_ISSUED issued
    ON register_number.SB_REGISTER_NUMBER = ISSUED.SB_REGISTER_NUMBER
    AND REGISTER_NUMBER.SB_REGISTER_NUMBER IN(1240)
)
2
  • Correct me if I'm wrong, but shouldn't you declare the alias using AS? Commented Oct 1, 2013 at 14:54
  • In Oracle you don't have to use the AS keyword for aliases - providing the alias after a column works just fine. Commented Oct 1, 2013 at 14:58

2 Answers 2

1

You cannot reference an alias in the JOIN condition - write the actual column name: sb_title.

Sign up to request clarification or add additional context in comments.

Comments

0

I don't think you can use the alias "Q" like that. You're aliasing it in your select clause, don't think you can use that alias in your ON clause. Try using the full column name (sb_title).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.