0

我在 Oracle 10 XE 中运行以下查询并得到[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)
)
4

2 回答 2

1

您不能在 JOIN 条件中引用别名 - 写入实际的列名:sb_title。

于 2013-10-01T14:57:45.623 回答
0

我认为您不能像那样使用别名“Q”。您在 select 子句中为它起别名,不要认为您可以在 ON 子句中使用该别名。尝试使用完整的列名 (sb_title)。

于 2013-10-01T14:58:11.603 回答