Suppliersset supplier table sysId is id
Contacts the contacts table groupSysId is suppliersset sysId
Establish a trigger when delete a vendor record delete this supplier all contacts
Create the trigger delecontacts
After the delete on suppliersset
For each row
The begin
Delete from the contacts where contacts. GroupSysId=old. SysId;
End $
Tip 5 line 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 'at line 5
CodePudding user response:
The front add delimiter $CodePudding user response:
$delimiterCreate the trigger delecontacts
After the delete on suppliersset
For each row
The begin
Delete from the contacts where contacts. GroupSysId=old. SysId;
End $