Ver Mensaje Individual
  #6 (permalink)  
Antiguo 08/06/2009, 09:10
Tucky5
 
Fecha de Ingreso: mayo-2009
Ubicación: Valencia
Mensajes: 18
Antigüedad: 15 años
Puntos: 0
Respuesta: Trigger para sumar 1 después de insertar

Hola otra vez:
Veis algo mal en la sintaxis?

CREATTE TRIGGER sumahabitacion
AFTER INSERT ON habitaciones
FOR EACH ROW BEGIN
IF NEW.Tipo='Simple'
THEN UPDATE alojamientos
SET Simples=Simples+1 WHERE NEW.idHotel=alojamientos.identificador;
ELSE UPDATE alojamientos
SET Dobles=Dobles+1 WHERE NEW.idHotel=alojamientos.identificador;
END IF;
END;

Gracias. un saludo!!