>Yes, this Select should be splitted on two, the first one will do Select Distinct ... Into Cursor..., and next one will join the cursor.
Not necessaraly. You can do the same if you move JOIN into where condition like
where ResNum in (select distinct ResNum from ...)
If it's not broken, fix it until it is.
My Blog