Subject Re: [firebird-support] Order of WHERE operations
Author Ann W. Harrison
Rick DeBay wrote:
> In what order to WHERE statements get evaluated? I want to make sure
> the existence clause gets evaluated first.
>
> INSERT INTO PURCH_ORDER (PO,REPLENISH_GRP,ACCOUNT,DIST_CTR,SUBMITTED)
> SELECT ?,REPLENISH_GRP_ID,?,?,?
> FROM V_REPLENISH_GRP
> WHERE SUPPLIER_ACCT=?
> AND NOT EXISTS (SELECT ID FROM PURCH_ORDER WHERE PO=?);
>

The order of evaluation is determined by the optimizer. You may be able
to force this evaluation with a plan.

Regards,


Ann