update warehouse_join_stock_order wjso set delivery_quantity = wjso.delivery_quantity ${plusOrMinus} wed.delivery_qty from warehouse_escort_detail wed left join warehouse_escort we on wed.escort_id=we."id" where wjso."id"=wed.stock_order_id and wed.active=true and we."id"=#{id} update plan_customer_order pco set delivery_quantity=tempA.delivery_quantity from (select wjso.customer_order_id,sum(wjso.delivery_quantity) delivery_quantity from warehouse_escort we left join warehouse_escort_detail wed on wed.escort_id = we."id" left join warehouse_join_stock_order wjso on wjso."id" = wed.stock_order_id where we."id" = #{id} and wed.active = true group by wjso.customer_order_id) tempA where pco."id" = tempA.customer_order_id