两表联合删除的问题 环境:mysql4.1.6求以下语句的正确写法delete from a where id not in (select id from b) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 试试delete a from a,b where a.id != b.id; delete from a where id not in (select id from b) ;这个语句,mySQL4已经支持了。你的报错信息是什么? [align=center]==== 思想重于技巧 ====[/align] reply via CSDN viewer delete a from a,b where a.id != b.id;上面这条语句可能会把你的表清空.最好先备份下.试试delete from a using a left join b on b.id=a.id where b.id is NULL 另外一种思路:delete from a where id not in (select id from b) select a.* into newtt from a left join b on a.id=b.id where b.id is null navivat中的“模型”能做什么?(新手学习中) 一个奇葩的问题、、PostgreSQL可否查询一个schema或者数据库的索引总数目? 索引的Cardinality是什么意思? 为什么要使用分页存储过程? mysql怎么导入数据 关于排序 mysql中更新字符型字符 怎样将Sql Server中的数据转换到My Sql 中? 大虾们,那里有mysql教程呀?我怎么不会用它呀,faint!在win2000下 本人刚刚开始学习数据库,可是学的非常迷糊.求推荐数据库设计书籍. 同一台主机 mysql中 两个数据库间的复制 Mysql数据,不能写入,请教高手指点!
试试
delete a from a,b where a.id != b.id;
[align=center]==== 思想重于技巧 ====
[/align]
上面这条语句可能会把你的表清空.最好先备份下.试试
delete from a using a left join b on b.id=a.id where b.id is NULL
delete from a where id not in (select id from b)
select a.* into newtt from a left join b on a.id=b.id where b.id is null