MySQL中,有一个货物表GoodsTable,其中有两个字段GoodsID和Quantity,若只使用一条SQL语句,使特定GoodsID的Quantity减去一个数,应该如何表达呢?请高手赐教,不胜感激!
设想:update GoodsTable set quantity=((select quantity from Goodstable where GoodsID=1)-2) where GoodsID=1;
结果:ERROR 1093 (HY000): You can't specify target table 'GoodsTable' for update in FROM clause