鉴于我有这个数据库结构。
表:watchcount
uid steamID sessionid watchcount items
1 234234234 1232432 634 0
我想在watchcount更新后自动更改列项。将watchcount除以60后,将值置于显示为整数的值。像这样:
watchcount items
634 10
答案 0 :(得分:1)
你走了:
create trigger update_items
before update on watchcount
for each row
set new.items = floor(new.watchcount/60);