The purpose of this query is to find out a location that holds $itmcls and $itmcod, if such locations are found, I want to pick the one with the minimum DIST value.
(This is in SQR code by the way, but I want to know about performance-wise if it's better than another method)
select
MIN(L1.LOCATN) &ret_locatn
from LOCATN L1
WHERE
L1.ITMCLS = $itmcls AND
L1.ITMCOD = $itmcod AND
L1.ARECOD = {AP$_ARECOD_PW_SQL} AND
L1.ZONTRV =
(select
MIN(L2.DIST)
from LOCATN L2
where
L2.ITMCLS = L1.ITMCLS AND
L2.ITMCOD = L1.ITMCLS AND
L2.ARECOD = {AP$_ARECOD_PW_SQL})
end-select
I was wondering if I could get any performance advantage by comparing L2 with L1's ITMCLS and ITMCOD. I was comparing
L2.ITMCLS = $itmcls AND
L2.ITMCOD = $itmcod
previously.
Thanks.