------解决方案--------------------既然有 id 就继续删嘛
或者高级点:用触发器
------解决方案--------------------手册说:
通过在FOR EACH ROW之后使用BEGIN ... END复合语句结构,能够定义执行多条语句的触发程序。
------解决方案--------------------DELIMITER $$
create trigger xi_delete after delete
ON xinxi for each row
FOR EACH ROWBEGIN
delete from us_xi where userid=old.userid,
delete from ccs_image where userid=old.userid,
delete from guestbook where userid=old.userid,
delete from friends where userid=old.userid;
END$$
DELIMITER;
------解决方案--------------------老大都说了“既然有 id 就继续删嘛”。
联表删!
------解决方案--------------------一般都是一个一个地删除。