with tRMS_CODE as
(SELECT DISTINCT RMS_CODE FROM RMS_Table)
, tRMS_ALT1_Cde as
(SELECT DISTINCT RMS_ALT1_Cde FROM RMS_Table)
SELECT DISTINCT * FROM RMS_Table
WHERE
SUBSTR(CHILD,6,4) NOT IN (SELECT * FROM tRMS_CODE) AND
SUBSTR(CHILD,6,4) NOT IN (SELECT * FROM tRMS_ALT1_Cde) AND
APC_Spec='36559'
尝试这个: