Syntaxe vložení je
INSERT INTO table (columns_list) VALUES (values_list)
takže vaše vložka by vypadala asi takto (nejsem expert na MySQL, ale můžete se na dotaz vejít):
INSERT INTO data_tracking
(`data_id` , `field` , `old_value` , `new_value` , `modified` )
VALUES
(NEW.data_id, 'field1', OLD.field, NEW.field, CURRENT_DATETIME());
A opakujte to pro variantu pole2 a pole3
Myslím, že toto by byl úplný spouštěč, zkuste prosím:
DELIMITER $$
DROP TRIGGER `update_data `$$
CREATE TRIGGER `update_data` AFTER UPDATE on `data_table`
FOR EACH ROW
BEGIN
IF (NEW.field1 != OLD.field1) THEN
INSERT INTO data_tracking
(`data_id` , `field` , `old_value` , `new_value` , `modified` )
VALUES
(NEW.data_id, "field1", OLD.field1, NEW.field1, NOW());
END IF;
IF (NEW.field2 != OLD.field2) THEN
INSERT INTO data_tracking
(`data_id` , `field` , `old_value` , `new_value` , `modified` )
VALUES
(NEW.data_id, "field2", OLD.field2, NEW.field2, NOW());
END IF;
IF (NEW.field3 != OLD.field3) THEN
INSERT INTO data_tracking
(`data_id` , `field` , `old_value` , `new_value` , `modified` )
VALUES
(NEW.data_id, "field3", OLD.field3, NEW.field3, NOW());
END IF;
END$$
DELIMITER ;