Sql上的无效标识符离开了加入oracle

时间:2014-12-17 13:58:26

标签: sql oracle select join left-join

您好我在以下查询中遇到了一些问题

SELECT *
FROM PARTNER P
     , ADDRESS A
     ,DOSSIERPARTNERRELATIONSHIP DPR
   LEFT JOIN PARTNERHIST PH ON P.ID=PH.PARTNER_ID
WHERE (P.NAME ='Burger' OR PH.NAME='Burger')
 AND P.ID = DPR.PARTNER_ID
 AND A.PARTNER_ID = P.ID
 ;

当我试图执行它时,我收到以下错误:

  

ORA-00904:" P"。" ID":无效的标识符

此外,当我尝试以下操作时,我遇到了同样的错误

SELECT *
FROM PARTNER P
     , ADDRESS A
     ,DOSSIERPARTNERRELATIONSHIP DPR
   LEFT JOIN PARTNERHIST PH ON PARTNER.ID= PH.PARTNER_ID
WHERE (P.NAME ='Burger' OR PH.NAME='Burger')
 AND P.ID = DPR.PARTNER_ID
 AND A.PARTNER_ID = P.ID
 ;

1 个答案:

答案 0 :(得分:5)

试试这个:

SELECT *
FROM PARTNER P
INNER JOIN ADDRESS A ON A.PARTNER_ID = P.ID
INNER JOIN DOSSIERPARTNERRELATIONSHIP DPR ON P.ID = DPR.PARTNER_ID
LEFT JOIN PARTNERHIST PH ON P.ID= PH.PARTNER_ID
WHERE (P.NAME ='Burger' OR PH.NAME='Burger')