mysql 触发器 insert 时更新另一个表where等于条件的记录更新不起?
DROPTRIGGERIFEXISTSAddTopics;createtriggerAddTopicsafterinsertonfm_topicsforeachrowbe...
DROP TRIGGER IF EXISTS AddTopics;
create trigger AddTopics
after insert on fm_topics
for each row
begin
UPDATE
fm_forum
SET
topics = (select count(*) from fm_topics where fm_topics.parenttid=0 and fm_topics.fid =new.fid)
WHERE
fid = new.fid ;
end ;
fm_forum 中的fid=new.fid的这一条记录更新不起,但是fid<>new.fid就行啊?
求高手指点 展开
create trigger AddTopics
after insert on fm_topics
for each row
begin
UPDATE
fm_forum
SET
topics = (select count(*) from fm_topics where fm_topics.parenttid=0 and fm_topics.fid =new.fid)
WHERE
fid = new.fid ;
end ;
fm_forum 中的fid=new.fid的这一条记录更新不起,但是fid<>new.fid就行啊?
求高手指点 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询