I've got this trigger:
CREATE DEFINER = `root`@`localhost` TRIGGER `ograniczenie` BEFORE INSERT ON `wyjscia`
FOR EACH ROW
BEGIN
SELECT COUNT( * ) INTO @cnt FROM wyjscia;
IF @cnt >=5 THEN
DELETE FROM wyjscia WHERE id = ((SELECT MIN(id) FROM wyjscia)) LIMIT 1 ;
END IF ;
END
Error: #1442 - Can't update table 'wyjscia' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
Is there any solution of this problem? :(