oracle sql developer:00904. 00000 – “%s:无效标识符”.我的错在哪里?

我正在努力找到我的错.
我收到此错误消息:

SQL-Fehler: ORA-00904: “S1″.”PARTNO”: ungültiger Bezeichner
00904. 00000 – “%s: invalid identifier”

我检查了我的数据库,所有表都存在.

这是我的sql代码:

select s1.*
 , p.city as "Produktionsort" 
 , p.partname
from (select count(s.partno) as "Anzahl_Produktarten"
        , s.partno as "Partno" 
      from company.supp_part_job s 
      group by s.partno ) s1
 , company.part p 
where s1.partno IN (select p1.partno from company.part p1 where p1.city != 'London') 
   and p.partno = s1.partno 
group by s1.partno
因为您在内部select(s1)partno中别名为“Partno”,所以必须在外部查询中将其称为区分大小写:

select s1.*
 , p.city as "Produktionsort" 
 , p.partname
from (select count(s.partno) as "Anzahl_Produktarten"
        , s.partno as "Partno" 
      from company.supp_part_job s 
      group by s.partno ) s1
 , company.part p 
where s1."Partno" IN (select p1.partno from company.part p1 where p1.city != 'London') 
   and p.partno = s1."Partno" 
group by s1."Partno"
相关文章
相关标签/搜索