数据重复的问题,100分求助

guangli_zhang 2003-01-10 01:44:31
如何从表中删除相同条件中的n条,使只留一条记录?
这一条记录,为相同条件记录中的任何一条。
...全文
91 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ice2water 2003-01-13
  • 打赏
  • 举报
回复
insert into #tmp
select col1, col2,.. from tablename
group by col1, col2,...
where having(count(*)>1);
delete tablename from tablename a, #tmp b
where a.col1=b.col1 and a.col2=b.col2 ...
insert into tablename
select * from #tmp
alan2118 2003-01-13
  • 打赏
  • 举报
回复
tj_dns(愉快的登山者)的方法应该可行啊。
如果没有唯一ID号,就先给加个唯一ID,做完后再删掉也可以的嘛。
flyhot 2003-01-10
  • 打赏
  • 举报
回复
no way to delete the db!
lmf2008 2003-01-10
  • 打赏
  • 举报
回复
用datastore
jdsnhan 2003-01-10
  • 打赏
  • 举报
回复
完全相同?关键字怎么处理啊
bomber2001 2003-01-10
  • 打赏
  • 举报
回复
up
morningdew 2003-01-10
  • 打赏
  • 举报
回复
写代码吧..用数据窗口一条一条的处理.....
bbsuner 2003-01-10
  • 打赏
  • 举报
回复
我想问你一下,相同的记录你如何保存到库里的啊,
guangli_zhang 2003-01-10
  • 打赏
  • 举报
回复
对不起,数据库是PB自带的
愉快的登山者 2003-01-10
  • 打赏
  • 举报
回复
delete tablename from
(select col1, col2, ...,mix(id) as id from tablename
group by col1, col2, ...) as A
where col1 = A.col1
and col2 = A.col2
and ...
and id <> A.id

752

社区成员

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

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