Itu karena mysql melihat ;
(pembatas) dan menghentikan eksekusi CREATE TRIGGER
Coba ubah ke:
delimiter |
CREATE TRIGGER ins_saved_listing BEFORE INSERT ON saved_listing
FOR EACH ROW BEGIN
SET NEW.create_dt = NOW();
SET NEW.rank = (SELECT MAX(rank) + 1 FROM saved_listing WHERE user_id = NEW.user_id);
END;
|
delimiter ;