documentation_level_desc in the first sub query has been aliased as cmdm_doc_type, and SPECIAL_FEATURE_CODE in the second sub query has been aliased as Harp_CODE. Therefore in the main where clause the original field names can not be used, instead their alias names should be used.