Using Query to create a temporary file, then another Query to create another temporary file and finally a third query to process that file is kind of opposite of the way we think about SQL. SQL is about manipulating sets of records.
This is untested:
select h.IHDOCD, h.IHENT#, h.IHSFX#, h.IHINV#, a.ADINTA
from OEINH1 h
join Address_Table a
on h.ihent# = a.customer_id
where h.IHORDT = 'INT'
AND h.IHVIAC not in ('PML' 'FCM')
AND ADSFX# = '000'
and h.ihent# in (
select cor.ihent#
from oeinh1 cor
where cor.IHORDT in ('COR' 'COE'))