首页 > 数据库技术 > 详细

MySql触发器

时间:2019-11-26 16:07:30      阅读:71      评论:0      收藏:0      [点我收藏+]
begin
      declare num int;
      set num=(select count(*) from 表名 where BusinessId=new.Id and businessType=2 and Type=10);
      if num=0 then
          insert 表名(Id,Type,BusinessId,businessType,Status,Count,IsDeleted) values(uuid_short(),10,new.Id,2,2,1,1);
      else
          update 表名 set Count=0 where BusinessId=new.Id and businessType=2 and Type=10;
      end if;
end

 

参考:https://blog.csdn.net/qq_15058425/article/details/72673788

MySql触发器

原文:https://www.cnblogs.com/LJing21/p/11935598.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!