Subject Re: [ib-support] Query optimiser - inner join - left join
Author Svein Erling Tysvaer
Oops, I forgot to take a closer look at your select. You can change this
whole query to simply

select pr.Inc_Reqn,
pr.PartNo, pr.PartParam, pr.Operation,
pr.FulfilUnitsQty, pr.RequesterNo, jm.Division,
pr.FulfilInc_Cost, pr.RequiredDte, pr.Destination
from PurchRequisition pr
left join JobMast jm on ( jm .JobNo = pr.RequesterNo )
where exists (select 1 from PurchReqTags prt where (prt.Inc_ReqnB =
:AiInc_ReqnB or 2=0) and prt.Inc_Reqn = pr.Inc_Reqn)
and ( pr.Actioned = 'N' )
and ( pr.FulFilSuppNo = :sSuppNo )

[The 'or 2=0' bit is only useful if prt.Inc_Reqn is pretty selective
whereas prt.Inc_ReqnB is not. If this is not the case, remove 'or 2=0'.]

Though admittedly, this does not answer your question.

Set

At 12:05 05.03.2003 +0000, you wrote:
>select prt.Inc_Reqn,
> pr.PartNo, pr.PartParam, pr.Operation,
> pr.FulfilUnitsQty, pr.RequesterNo, jm.Division,
> pr.FulfilInc_Cost, pr.RequiredDte, pr.Destination
>from PurchReqTags prt
>inner join PurchRequisition pr on ( prt.Inc_Reqn = pr.Inc_Reqn )
>left join JobMast jm on ( jm .JobNo = pr.RequesterNo )
>where ( prt.Inc_ReqnB = :AiInc_ReqnB )
>and ( pr.Actioned = 'N' )
>and ( pr.FulFilSuppNo = :sSuppNo )