I wrote following code:
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;
$$
Table “things” has got:
id1 (PK)
name
thing_cost
Table dude_base has got:
id2 (PK)
salary
name, etc. irrevelant
Table current has got:
id1 (FK)
id2(FK)
curr_cash
I got following error:
#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
Any help?
I think you should have a semicolon
;liketo end this query because
UPDATEis another query// edit
try it like this