我是 Oracle DB 的新手,遇到了一個我不太明白的錯誤。
我有兩個表,table1 和 table2,table1 中的 ID 主鍵欄位是 table2 中的外鍵。
這是一個作業正常的查詢:
select c.* from table1 c
inner join table2 c2 on c.ID = c2.RID
問題是我正在嘗試撰寫一個更復雜的查詢,一旦我將更多表添加到我的查詢中,我就會收到此錯誤ORA-00904: C"."ID": invalid identifier,當我運行以下命令時會收到此錯誤:
select c.* from table1 c, table3 a, table4 b
inner join table2 c2 on c.ID = c2.RID
我已經看過這個執行緒尋求幫助,但它并沒有真正幫助我的情況(除非我錯過了一些東西,但我對此表示懷疑)
uj5u.com熱心網友回復:
只需將連接堆在一起,例如:
select c.*
from table1 c
inner join table2 c2 on c.ID = c2.RID
inner join table3 a on [c.ID = a.RID] --you have not provided the relations for this
inner join table4 b on [c.ID = b.RID] --you have not provided the relations for this
如果你仍然從 c.ID 得到一個無效的識別符號,我會仔細檢查 ID 是否真的是正確的列名。
請提供表格定義以及它們應如何關聯以獲得更好的答案
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/380090.html
