我写了以下代码:
create trigger money after update on `things`
for each row
begin
Select @c1=sum(`thing_cost`) from `things`
UNION
Select @c2=sum(`salary`) from `dude_base`
Update `current` set `curr_cash`=@c1*@c2/100
end;
$$
表“东西”有:
id1 (PK)
name
thing_cost
表 dude_base 有:
id2 (PK)
salary
name, etc. irrevelant
表电流有:
id1 (FK)
id2(FK)
curr_cash
我收到以下错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use
near 'Update `current` set `curr_cash`=@c1*@c2/100; END' at line 7
有什么帮助吗?