I need to create a trigger for MySQL database table. I want to put a message in one table following the update of another table. The trigger should only operate on each new entry as it arrives. I have found out how to do this on an SQL Server how can I do it in MySQL. The following code is the SQL server:
CREATE TRIGGER autoreply ON table1 FOR INSERT
AS
DECLARE @tel VARCHAR(30)
SELECT TOP 1 @tel=field1 FROM table1 ORDER BY ID DESC
INSERT INTO table2 (field2,field3,field4) VALUES
(@tel,'Thank you for the message','send')
GO
It would be great if you could help
CREATE TRIGGER autoreply ON table1 FOR INSERT
AS
DECLARE @tel VARCHAR(30)
SELECT TOP 1 @tel=field1 FROM table1 ORDER BY ID DESC
INSERT INTO table2 (field2,field3,field4) VALUES
(@tel,'Thank you for the message','send')
GO
It would be great if you could help