• 8195阅读
  • 4回复

删除数据库中重复数据[supfrie] [复制链接]

上一主题 下一主题
离线XChinux
 

只看楼主 倒序阅读 楼主  发表于: 2005-07-30
— 本帖被 XChinux 执行加亮操作(2008-04-04) —
select distinct * from tableName

  就可以得到无重复记录的结果集。

  如果该表需要删除重复的记录(重复记录保留1条),可以按以下方法删除

   select distinct * into #Tmp from tableName

   drop table tableName

   select * into tableName from #Tmp

   drop table #Tmp
二笔 openSUSE Vim N9 BB10 XChinux@163.com 网易博客 腾讯微博
承接C++/Qt、Qt UI界面、PHP及预算报销系统开发业务
离线ling2306
只看该作者 1楼 发表于: 2006-05-30
thank you
离线zncggaofei
只看该作者 2楼 发表于: 2008-04-03
用临时表替换哇
There is someone that is coming or passing away in your life around the clock, so you may lose sight of those seen, and forget those remembered. There is gain and loss in your life, so you may catch sight of those unseen, and remember those forgotten. Nevertheless, doesn’t the unseen exist for sure? Will the remembered remain forever?
离线dzhdiv
只看该作者 3楼 发表于: 2008-04-08
蛮不错的说哈。。谢谢分享














我的人生感言:It's never too old to learn wow gold .A journey of a thousand miles begins with a maple story mesos single step,and I like logo design.
离线captain08
只看该作者 4楼 发表于: 2008-04-08
挺好
快速回复
限100 字节
 
上一个 下一个