Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/11/2012, 02:06
joeglo
 
Fecha de Ingreso: noviembre-2012
Mensajes: 2
Antigüedad: 11 años, 5 meses
Puntos: 1
Respuesta: Update Entre tablas

Hola el problema, creo que se tiene que solucionar añadiendo el WHERE correspondiente el UPDATE, ya que si no lo añades estas actualizando todos los ingredientes. Quedaría así:
UPDATE Ingrediente a
SET a.Cantidad = NVL(a.Cantidad -(SELECT b.Cantidad FROM Receta b WHERE b.CodigoIngrediente =a.CodigoIngrediente
AND b.CodigoProducto=100),0)
WHERE a.CodigoIngrediente IN (SELECT c.CodigoIngrediente FROM Receta c WHERE c.CodigoProducto=100)