针对有网友说看不见文章内容, 现提示如下: 点击每一个标题行任一地方都会展开和隐藏此文章内容(不要点击标题). 目前展开隐藏功能只支持IE浏览器,虽然可以改成支持FF浏览器,不过现在一直没时间去弄,等有时间再修改了。 |
blog名称:乱闪Blog 日志总数:267 评论数量:1618 留言数量:-26 访问次数:2656482 建立时间:2005年1月1日 |
|

| |
如何删除表中的重复记录?
|
作者: NinGoo 加入时间: 2005-01-12 文档类型: 转载 来自: 浏览统计: total: 62 year: 62 quarter: 62 month: 62 week: 24 today: 4
--测试数据/*-----------------------------select * from tt-----------------------------*/id pid ----------- ----------- 1 11 12 23 33 33 3
(所影响的行数为 6 行)首先,如何查询table中有重复记录select *,count(1) as rownumfrom ttgroup by id, pidhaving count(1) > 1id pid rownum ----------- ----------- ----------- 1 1 23 3 3
(所影响的行数为 2 行)方法一:使用distinct和临时表if object_id('tempdb..#tmp') is not nulldrop table #tmpselect distinct * into #tmp from tttruncate table ttinsert into tt select * from #tmp方法二:添加标识列alter table tt add NewID int identity(1,1)go delete from tt where exists(select 1 from tt a where a.newid>tt.newid and tt.id=a.id and tt.pid=a.pid)goalter table tt drop column NewIDgo--测试结果/*-----------------------------select * from tt-----------------------------*/id pid ----------- ----------- 1 12 23 3 |
|
回复:如何删除表中的重复记录?
|
电脑与网络 FD(游客)发表评论于2005/9/15 11:49:50 |
| |
» 1 »
|