delimiter |
create trigger submit_update
after update
on submit
for each row
begin
if OLD.status<>40 AND NEW.status=40 then
update contestinfo set accept = accept+1 where contestinfo.contestid=NEW.contestid and contestinfo.pid=NEW.pid;
elseif OLD.status=40 AND NEW.status<>40 then
update contestinfo set accept = accept-1 where contestinfo.contestid=NEW.contestid and contestinfo.pid=NEW.pid;
end if;
end
|
delimiter ;