Author: chelule

You can’t specify target table for update in FROM clause

While doing my usual complex queries i hit into this error

“You can’t specify target table for update in FROM clause”

Apparently you can’t update table which you  are selecting from and you ain’t doing nothing about it. Mysql you just let me down abit how am i gonna do something like this ?

UPDATE `kvn_purchase_orders` SET `check`=1 WHERE `id`not in 
(select kvn_purchase_orders.id from kvn_purchase_orders  inner join kvn_purchase_amounts on  kvn_purchase_amounts.purchase_order_id=kvn_purchase_orders.id)
 and state_id=2