私は次のコードを書きました:
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;
$$
テーブル「things」には次のものがあります。
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
何か助けはありますか?