/////// 语句1:delete from sheng,city,dian using sheng,city,dian where sheng.sid=2 and city.sid=sheng.sid and dian.cid=city.cid
/////// 这条语句执行时,要保证三个表中必须有满足语句中要求的数据是才可以删除,否则数据不能删除,但不提示错误,因为语法正确
/////// 语句2:DELETE a,b from a LEFT JOIN b ON a.id=b.pid WHERE a.id=1
/////// a表是父表,b表为子表,删除a表中的某一条记录,同时删除b表中相关联的记录,b表中可以没有与a表中相关联的数据
/////// 那就只删除a表中的数据,而语句1 不能实现这个
满足要求的数据例如
--------------------------
省区表 |
--------------------------
sid shengname |
--------------------------
1 北京 |
-------------------------
---------------------------------------
城市表 |
---------------------------------------
cid cityname sid |
---------------------------------------
2 北京 1 |
---------------------------------------
--------------------------
公司表 |
--------------------------
cid shengname |
--------------------------
2 google |
-------------------------
mysql 一条语句删除多表数据
3星 · 超过75%的资源 需积分: 41 57 浏览量
2009-01-16
12:27:39
上传
评论
收藏 625B RAR 举报
kunlilove521
- 粉丝: 2
- 资源: 24