this is the query that i am using
create trigger trig1 after insert on participant for each row
begin
insert into team(sap) select sap from participant order by ID desc limit 1,1
end;
it is supposed to copy the sap field from the participant table into the sap field of the team table after a new row is inserted into the participant table
the engine shows me an unexpected end of input error at the end of “end”
i’ve tried numerous methods to rework the query but i keep getting the same error
what am i doing wrong?
thanks
You are using trigger than no need to run a query on same table to get latest sap value, you can directly get that value using new.sap.
Problem in your query, In your query you haven’t put semicolon(;) after INSERT..SELECT query and END keyword.
This will work for you: