CREATE TRIGGER t_produce_company_brand_q AFTER INSERT ON tp_produce FOR EACH ROW BEGIN update tp_produce p set p.brand = (select c.name from tp_company c where c.id = new.company_id),p.address = (select c.address from tp_company c where c.id = new.company_id);
END;
当tp_produce插入新数据时,根据新数据的company_id 字段查询 tp_company 表中的 name 和address 更新 该条数据。
请问我这触发器有写错吗?为什么插入新数据时提示下面的错误:
慕田峪9158850
相关分类