UPDATE cart_inventory_temp as ci
SET error_flag=1
WHERE ci.nationalDrugCode NOT IN(SELECT ndc FROM onelink as ol
INNER JOIN cart_inventory_temp as ci
WHERE (ol.ndc=ci.nationalDrugCode OR ol.sku=ci.sku))
The error code is:
Error Code: 1093
You can't specify target table 'ci' for update in FROM clause
So I want to mark all the ones with errors. The ones that there is no matching ci.nationalDrugCode with o.ndc, the ndc is valid if there is a match on either the ndc or the sku. The sub-select works, the update query has the error. tia,