Hello, I have this problem with a query
DELIMITER //
CREATE TRIGGER pagos AFTER INSERT ON Pagos
FOR EACH ROW
BEGIN
SET @puesto = (SELECT e.puesto FROM Empleado AS e, Pagos AS p WHERE
e.idEmpleado=p.Empleado_idEmpleado);
IF @puesto='Administrador' THEN
CALL Administrador(new.Empleado_idEmpleado);
END IF;
IF @puesto='Gerente administrativo' THEN
CALL Gerente_administrativo(new.Empleado_idEmpleado);
END IF;
IF @puesto='Coordinador' THEN
CALL Coordinador(new.Empleado_idEmpleado);
END IF;
IF @puesto='Jefaturas' THEN
CALL Jefaturas(new.Empleado_idEmpleado);
END IF;
IF @puesto='Secretarias' THEN
CALL Secretarias(new.Empleado_idEmpleado);
END IF;
IF @puesto='Intendente' THEN
CALL Intendente(new.Empleado_idEmpleado);
END IF;
END//
DELIMITER ;
I have this trigger with which I want to evaluate the position of the employees who are receiving a payment. The problem is that when I insert the ids of the employees in the payment table, it sends me an error when doing the query inside the trigger:
ERROR 1242 (21000): Subquery returns more than 1 row