SQL Server查询语句过滤重复的数据
发布时间:2020-12-12 12:35:51 所属栏目:MsSql教程 来源:网络整理
导读:情况一:表中存在完全重复的的数据,即所有字段内容都是相同的 create table # (用户ID int, 姓名 varchar(10), 年龄 int ) insert into # select 111, '张三', 26 union all select 222, '李四', 25 union all select 333, '王五', 30 union all select 111,
情况一:表中存在完全重复的的数据,即所有字段内容都是相同的 create table # (用户ID int, 姓名 varchar(10), 年龄 int ) insert into # select 111, '张三', 26 union all select 222, '李四', 25 union all select 333, '王五', 30 union all select 111, 26 方法: select distinct * from # 情况2:表中存在部分数据重复的字段,即 重复数据中至少有一个字段不重复 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |