MySQL Trigger不会工作,但类似的

时间:2014-01-22 21:07:22

标签: mysql triggers

这是一个MySQL触发器

IF ... THEN
#User Lost
UPDATE users SET h2h_money = h2h_money - ( SELECT entry FROM contests WHERE contestid = new . contestid ) WHERE username = new . username;
#User Won
UPDATE users SET h2h_money = h2h_money + new . prize WHERE username = new . username;
#Money Entered
UPDATE users SET h2h_money_entered = h2h_money_entered + ( SELECT entry FROM contests WHERE contestid = new . contestid ) WHERE username = new . username;

#Money输入下的查询有效,但#User Lost不起作用。它不会从用户赢得的总金额中扣除入场费。如果它有所不同,则h2h_money的默认值为0.

如果重要的话,字段类型是小数。

0 个答案:

没有答案