表:note
ID content num
1 asjdlsdf 0
2 asda sewaeawe 0
3 asdasdasd 0如果select content from note where id=1; 那么 num+1 可以实现吗,在Mysql里触发器好像只对update,insert, delect 有用MySQL
ID content num
1 asjdlsdf 0
2 asda sewaeawe 0
3 asdasdasd 0如果select content from note where id=1; 那么 num+1 可以实现吗,在Mysql里触发器好像只对update,insert, delect 有用MySQL
if (select count(1) from note where id=1)>0
begin
update note set num=num+1 where id=1
select content from note where id=1
end上面的where 中的id=可以写成变量形式,目的就是先检查这个查询是否有数据,有就update,并查询。