The join condition is equal to
Z.ID = X.ORDER_NBR
OR
Z.ID = X.SUB_ORD_ID
You should always try to avoid ORed join conditions, they always lead to product joins.
To fix this you have to split the ORed join into two seperate queries using one of the conditions each and UNION ALL them.
Dieter
↧