简体   繁体   中英

Invalid Identifier In SQL Query

This query throws error ORA-00904: invalid identifier , Can anybody tell me why?

select papf.person_id, papf.person_number, ppnf.DISPLAY_NAME
from per_people_f papf, PER_PERSON_NAMES_F ppnf
where
papf.person_id=ppnf.person_id
and papf.person_id not in (select cs.person_id from cmp_salary cs where cs.person_id is not null and cs.ASSIGNMENT_ID is null )
and papf.person_id not in (select cse.person_id from cmp_salary_export cs where cse.person_id is not null and cse.ASSIGNMENT_ID is null )
and ppnf.name_type='US'
order by papf.person_id

It's a typo. In the second sub-query you have aliased all the column references cse. but you have aliased the table cs .

(select cse.person_id
 from cmp_salary_export cs 
 where cse.person_id is not null 
 and cse.ASSIGNMENT_ID is null )

Laying out your code with proper indentations is not just pedantry: making it easier to read makes it easier to debug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM