两表联合删除的问题 环境: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 怎么对mysql一个表两列相减,然后对减的结果整个求和 Mysql内存占用太高,8G被耗光了。 如何从系统表中取得mysql 函数的 参数 联接两个数据库中的两个表,要求先对一个表进行排序后分组 sql问题--精确匹配 新手求助.. 请教如何用SQL把多个字段(字符串)合并后保存到一个字段中。 谢谢 关于多表查询的问题 完全支持POSTGRESQL的EBB论坛2.1版提供下载 如何在VS.NET中连接MYSql 同一台主机 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