1
I made a Trigger to count the working days. It accepts the dates of the month 06 very well, but other dates gives the following error:
INSERT INTO `teste` VALUES ("2018-05-01")
#1292 - Incorrect date value: '20180532' for column 'i' at row 1
Trigger code:
BEGIN
DECLARE i date;
DECLARE j int;
SET i = DATE(NEW.dataAntiga);
SET j = 0;
WHILE (date(i) < NOW()) DO
if WEEKDAY(date(i)) != 5 AND WEEKDAY(date(i)) != 6 THEN
SET j = j + 1;
END IF;
SET i = date(i)+1;
END WHILE;
insert into teste2 values (j);
END
your Trigger is trying to insert 32/05/2018 and only
– Rovann Linhalis