高手请进,赐教。~~~~急急急急急急急急~~~~~~~

woolcool 2008-01-04 09:53:18
如果表中有1000条记录,
但是只有一百条记录是有效的,其他的都是重复记录,
高手赐教,如何用sql语句删除重复记录

重复记录在表中是无序的,位置不固定,
此问题困扰好长时间了
高手赐教
...全文
131 9 打赏 收藏 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
parss 2008-01-05
  • 打赏
  • 举报
回复
把表结构贴出来吧,不然不好写
中国风 2008-01-04
  • 打赏
  • 举报
回复
[code=SQL]create  table  T (id int)
insert into T select 1
insert into T select 2
insert into T select 3
insert into T select 5
insert into T select 5
insert into T select 7
insert into T select 7
insert into T select 8
insert into T select 9

go

select * from T a where (select count(1) from T where ID=a.ID)>1--显示重复记录
/*
id
-----------
5
5
7
7

(所影响的行数为 4 行)

*/

--删除
go
select distinct * into # from T

truncate table T

insert T select * from #

--查看
select * from T

/*
id
-----------
1
2
3
5
7
8
9

(所影响的行数为 7 行)

*/
[/code]
wzy_love_sly 2008-01-04
  • 打赏
  • 举报
回复
有标识列容易删除,没有就利用临时表删除
woolcool 2008-01-04
  • 打赏
  • 举报
回复
Create Table Num
(
num number;
)
;

insert into Num values(1);
insert into Num values(2);
insert into Num values(3);
insert into Num values(5);
insert into Num values(5);
insert into Num values(7);
insert into Num values(7);
insert into Num values(8);
insert into Num values(9);


这样怎么查询,不用虚拟表,就是用上边的这个真实得表,要是不用count呢
-狙击手- 2008-01-04
  • 打赏
  • 举报
回复
declare @tb table (id int)
insert into @tb select 1
insert into @tb select 2
insert into @tb select 3
insert into @tb select 5
insert into @tb select 5
insert into @tb select 7
insert into @tb select 7
insert into @tb select 8
insert into @tb select 9

select *
from @tb a
where exists (select id from @tb where a.id = id group by id having count(1) > 1)

/*

id
-----------
5
5
7
7

(所影响的行数为 4 行)
*/

select *
from @tb a
where id in (select id from @tb group by id having count(1) > 1)



/*

id
-----------
5
5
7
7

(所影响的行数为 4 行)
*/
woolcool 2008-01-04
  • 打赏
  • 举报
回复
不太懂,如何删除多余的重复记录
中国风 2008-01-04
  • 打赏
  • 举报
回复
--表T列重复有Col1\Col2
alter table T add ID int identity --新增一列
go

delete a from T a where exists(select 1 from T where Col1=a.COl1 and COl2=a.Col2 and ID<a.ID)
go
alter table drop column ID--删除新增列

---
如没有外健关联时:

select distinct * into # from T

truncate table T


insert T select * from #
wzy_love_sly 2008-01-04
  • 打赏
  • 举报
回复
declare @tb table (id int,name varchar(10))
insert into @tb select 1,'a'
insert into @tb select 2,'b'
insert into @tb select 3,'c'
insert into @tb select 5,'d'
insert into @tb select 5,'d'
insert into @tb select 7,'e'
insert into @tb select 7,'e'
insert into @tb select 8,'f'
insert into @tb select 9,'g'

select * from @tb group by id,name


1 a
2 b
3 c
5 d
7 e
8 f
9 g
wzy_love_sly 2008-01-04
  • 打赏
  • 举报
回复
declare @tb table (id int)
insert into @tb select 1
insert into @tb select 2
insert into @tb select 3
insert into @tb select 5
insert into @tb select 5
insert into @tb select 7
insert into @tb select 7
insert into @tb select 8
insert into @tb select 9

select distinct id from @tb a


1
2
3
5
7
8
9
内容概要:本文研究了基于深度强化学习的多无人机辅助边缘计算网络路径规划方法,旨在通过深度强化学习算法优化多无人机在执行任务时的飞行路径,以提高边缘计算网络的服务质量和效率。文中系统阐述了深度强化学习的基本原理及其在无人机路径规划中的应用,重点解决了动态环境适应性和多目标优化等关键技术难题。研究提出了一种高效的算法框架,能够有效应对复杂环境中的障碍物规避、能耗最小化和任务完成时间最短化等多重挑战。该框架通过Matlab代码实现,并经过大量仿真实验验证,结果表明,相较于传统路径规划方法,所提方法在确保飞行安全的前提下,显著提升了无人机的任务执行效率和网络服务质量,展现了优异的性能表现和广阔的应用前景。; 适合人群:具备一定编程基础,特别是熟悉Matlab编程语言,对无人机技术、边缘计算或深度强化学习感兴趣的科研人员和技术开发者。; 使用场景及目标:①为研究人员提供一种新的无人机路径规划解决方案,特别是在复杂动态环境下;②促进深度强化学习技术在无人机辅助边缘计算网络中的应用和发展;③为相关领域的工程技术人员提供技术支持和参考案例。; 阅读建议:读者在阅读本文时,应重点关注深度强化学习算法的设计思路及其在无人机路径规划中的具体应用,同时结合提供的Matlab代码进行实践操作,以便更好地理解和掌握该技术的核心要点。
已经博主授权,源码转载自 https://pan.quark.cn/s/a4b39357ea24 卷积神经网络(CNN,Convolutional Neural Network)属于一种深度学习模型类别,它对于处理具有规则网格状结构的数据类型表现尤为出色,尤其是图像数据。在手写体识别这一具体任务中,CNN能够高效地识别图像中的关键特征,例如笔画的几何形态、走向以及相互连接的模式,进而精确地识别出特定的手写字符。本项目的实现依托于TensorFlow框架,这是一个由Google研发的开源机器学习平台,其提供了大量便捷的工具和应用程序接口(API),用于构建和训练结构复杂的神经网络模型。 我们需要深入掌握卷积神经网络的基本构造。CNN通常由多个核心组件构成,包括卷积层(Convolutional Layer)、池化层(Pooling Layer)、全连接层(Fully Connected Layer)以及非线性激活函数(例如ReLU)。卷积层借助滤波器(Filter)在输入图像上执行扫描操作,负责特征的提取工作;池化层则通过降低数据的空间维度来提升计算效率;全连接层将提取出的特征与输出类别进行关联映射,最后采用Softmax函数完成最终的分类任务。 在这个手写字符识别的项目实践中,初始阶段可能进行了数据预处理步骤,涉及读取特定的二进制文件(比如train-labels.idx1-ubyte、t10k-labels.idx1-ubyte、train-images.idx3-ubyte、t10k-images.idx3-ubyte),这些文件可能存储了MNIST数据集中的手写数字图像及其对应的类别标签。MNIST数据集作为机器学习领域广泛应用的标准化基准,包含了60,000个训练...

34,876

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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