itjava2017
2017-07-12 09:40mysql触发器insert一直不被执行
DROP TRIGGER t_afterinsert_on_tab1 ;
CREATE TRIGGER t_afterinsert_on_tab1
AFTER insert ON a
for each row
BEGIN
if exists(select count(*) from a where a.tag_id=new.tag_id) THEN
update testhuanzhuanglie set value=new.temperature where name=new.tag_id;
else
insert into testhuanzhuanglie(NAME,value) values(new.tag_id,new.temperature);
end if;
END
- 点赞
- 回答
- 收藏
- 复制链接分享
3条回答
为你推荐
- mysql 触发器插入时条件问题
- sql
- mysql
- 2个回答
- 在GoSQL中处理数据库触发器
- mysql
- 1个回答
- 在MYSQL中插入JSON
- json
- php
- 1个回答
- 无法在PHP中为mySQL创建触发器
- web
- database
- mysql
- php
- 1个回答
- INSERT并设置一个字段以复制新插入的ID
- mysql
- pdo
- php
- 1个回答
换一换