我想在MySQL社區服務器5.5.16中創建一個更新觸發器。我有兩個表:觸發器更新另一個表錯誤
create table sales
(ono integer primary key,
dnr integer not null,
osum integer);
create table salessum
(dnr integer primary key,
dsum integer);
alter table sales
add constraint fk_sales_salessum foreign key (dnr)
references salessum (dnr);
我需要在表中的「銷售」的任何更新後更新表「salessum」。我已經創建觸發器:
Create trigger up_to_date
after update on sales
for each row
begin
update salessum
set dsum = dsum + new.osum;
where dnr=new.dnr;
end;
但我得到了一個錯誤:
ERROR 1064 (42000): 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 'where
dnr=new.dnr' at line 1
誰能幫我。謝謝。