I am writing this query:
CREATE EVENT `event_maid_availability` ON SCHEDULE EVERY 5 SECOND STARTS
'2015-08-12 10:16:47' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
SET @t1:=1;
INSERT INTO `maid_slots_availabilty`(`maid_slot_id`, `date`, `status`)
SELECT maids_slots.id,
DATE_ADD( CURDATE(), INTERVAL @t := @t + 1 DAY),
maids_slots.status
FROM
(SELECT *
FROM maids_slots
WHERE status = '1'
AND end_date IS NULL) AS `maids_slots`
INNER JOIN
(SELECT day_slot_id
FROM day_slots
WHERE day_id = DAYOFWEEK( curdate())-1) AS day_slots
WHERE day_slots.day_slot_id = maids_slots.day_slot_id;
ALTER TABLE maid_slots_availabilty AUTO_INCREMENT = 1; END;
And I am getting this error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
I am spend two days on this but I am not able to find where is the problem.