firebird 删除重复数据

spraini 2011-06-15 10:30:19
我用的firebird的数据库,我要删除里面的重复数据怎么写sql语句啊,请大家帮我一下啊,4.5G的数据,不能出错,出错就必死!!谢谢!!!
...全文
175 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
WWWWA 2011-06-15
  • 打赏
  • 举报
回复
select * from tt a where not exists(select 1 from tt where a.ntitile=ntitile
and a.ncontent=ncontent and a.id>id)

生成新表

delete a from tt a inner join tt b on a.ntitile=b.ntitile and a.ncontent=b.ncontent and a.id>b.id
修改为FB支持的SQL语法
spraini 2011-06-15
  • 打赏
  • 举报
回复
是一个新闻信息表,表中id是唯一的,ntitile,ncontent有重复,就是要删除ntitile重复的数据,留下唯一的一条
ACMAIN_CHM 2011-06-15
  • 打赏
  • 举报
回复
先备份一下。 然后建议使用 select distinct ... from ..
WWWWA 2011-06-15
  • 打赏
  • 举报
回复
详细说明,表中有无唯一标识的字段,
贴记录及要求结果出来看看

2,209

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 其他数据库
社区管理员
  • 其他数据库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧