码迷,mamicode.com
首页 > 数据库 > 详细

mysql关联表删除数据

时间:2019-08-18 15:54:22      阅读:80      评论:0      收藏:0      [点我收藏+]

标签:bsp   span   code   and   div   delete   存在   方法   from   

有时候我们需要删除表中部分内容,或删除一个表中在另一个表中已经存在的内容,可以用以下方法:

1、delete from t1 where 条件;

2、delete t1 from t1, t2 where 条件;

3、delete t1, t2 from t1, t2 where 条件;

 

eg:

删除表t1已经在表t2中存在的数据:

DELETE t1 FROM table_1 t1, table_2 t2
WHERE t1.id=t2.id and t1.year=t2.year and t1.month=t2.month;

mysql关联表删除数据

标签:bsp   span   code   and   div   delete   存在   方法   from   

原文地址:https://www.cnblogs.com/excellent123/p/11372200.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!