PS QUERY中不存在

时间:2018-05-22 08:53:29

标签: sql oracle peoplesoft

在Oracle的PeopleSoft ERP中,PeopleSoft查询工具(又名PS查询)用于生成SQL并通过Web界面为没有直接数据库访问权限的用户运行它。

通过使用not exists,我希望从我的查询中提取的值在我的子查询中不存在,因为它应该如何工作。

但是当我运行主查询时,我得到的值是:'0290','0477'和'0770',当检查我的子查询的记录时,它也存在。我已经检查了所有涉及的表上的键,我想我已将它们包含在标准中。

SELECT A.ADMIT_TERM FROM PS_ACAD_PROG A, PS_STDNT_AWD_PR_VW B
WHERE ( A.EFFDT = 
    (SELECT MAX(A_ED.EFFDT) FROM PS_ACAD_PROG A_ED 
    WHERE A.EMPLID = A_ED.EMPLID 
      AND A.ACAD_CAREER = A_ED.ACAD_CAREER 
      AND A.STDNT_CAR_NBR = A_ED.STDNT_CAR_NBR 
      AND A_ED.EFFDT <= SYSDATE) 
AND A.EFFSEQ = 
    (SELECT MAX(A_ES.EFFSEQ) FROM PS_ACAD_PROG A_ES 
    WHERE A.EMPLID = A_ES.EMPLID 
      AND A.ACAD_CAREER = A_ES.ACAD_CAREER 
      AND A.STDNT_CAR_NBR = A_ES.STDNT_CAR_NBR 
      AND A.EFFDT = A_ES.EFFDT) 
 AND A.EMPLID = B.EMPLID 
 AND A.ACAD_CAREER = B.ACAD_CAREER 
 AND B.INSTITUTION = A.INSTITUTION
 AND B.STRM = A.ADMIT_TERM 
 AND NOT EXISTS (SELECT D.STRM 
 FROM PS_STDNT_CAR_TERM D 
 WHERE D.EMPLID = A.EMPLID 
 AND D.ACAD_CAREER = A.ACAD_CAREER 
 AND D.INSTITUTION = A.INSTITUTION 
 AND D.STDNT_CAR_NBR = A.STDNT_CAR_NBR
 AND D.STRM = A.ADMIT_TERM));

有人可以告诉我我做错了吗?

0 个答案:

没有答案