SELECT
C.C_CODE, I.INV_NUM, I.INV_DATE, P.DESCRIPT, L.L_UNITS, L.L_PRICE
FROM
CUSTOMER C
JOIN
(SELECT *
FROM INVOICE I
JOIN
(SELECT *
FROM LINE L
JOIN (SELECT * FROM PRODUCT) P ON P.P_CODE = L.P_CODE) LP ON I.INV_NUM = LP.INV_NUM
ORDER BY I.INV_NUM DESC) ILP ON C.C_CODE = ILP.C_CODE
ORDER BY
C.C_CODE;
这是我得到的错误:
ORA-00904:" L"。" L_PRICE":无效的标识符
00904. 00000 - "%s:无效标识符
答案 0 :(得分:1)
您已经重新划分了表名,因此表L在上部选择级别不再可用 您应该使用已分配给与L_PRICE列相关的选择的正确(最后)(ILP)表名称
或您的表格中没有L_PRICE列
SELECT
C.C_CODE, I.INV_NUM, I.INV_DATE, P.DESCRIPT, L.L_UNITS, L.L_PRICE
FROM
CUSTOMER C
JOIN
(SELECT *
FROM INVOICE I
JOIN
(SELECT *
FROM LINE L
JOIN (SELECT * FROM PRODUCT) P ON P.P_CODE = L.P_CODE
) LP ON I.INV_NUM = LP.INV_NUM
ORDER BY I.INV_NUM DESC
) ILP ON C.C_CODE = ILP.C_CODE
ORDER BY
C.C_CODE;
答案 1 :(得分:0)
表别名L
在子查询中只有范围。
您的子查询具有别名ILP
;用那个:
SELECT ..., ILP.L_STATUS