>Thank you for your suggestion. I was expecting only 1 row as a return from those 2 subqueries. The problem ended up being a typo...in a DSPQOH I reference incorrect table alias:
>
>
>...where ItemMst.EDPNo = ItemMst.EDPNo
>
>
>
>it should have been
>
>
>where itm.EDPNo = ItemMst.EDPNo
>
>
>
>DAniel
Ok, glad you found it. Still, using derived tables usually produces result faster than subquery.
If it's not broken, fix it until it is.
My Blog