表結構描述
suppliersset 供應商表 sysId 是 id
contacts 聯系人表 groupSysId 是suppliersset.sysId
建立一個觸發器 在洗掉一個供應商記錄時 洗掉 此供應商的所有聯系人
create trigger delecontacts
after delete on suppliersset
for each row
begin
delete from contacts where contacts.groupSysId = old.sysId;
end$
提示5行錯誤
#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 '' at line 5
uj5u.com熱心網友回復:
最前面加一句 delimiter $uj5u.com熱心網友回復:
delimiter$
create trigger delecontacts
after delete on suppliersset
for each row
begin
delete from contacts where contacts.groupSysId = old.sysId;
end$
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/101051.html
標籤:MySQL
