I have two table stock detail and purchase.
When I'm trying to create a trigger on the table purchase it will seems an error that
"#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 "
Hear is my code
create TRIGGER afterinsert after insert on purchase for each row
BEGIN
set @qnty=(select quantity from stock_detail where brand_name = new.brand);
if(@qnty>=1) then
update stock_detail set quantity=@qnty+new.quanty;
end if;
END;
;so you needdelimiter //at the top and finallyEND;// delimiter ;