如何从sqlserver表中的表中删除重复数据 [英] How to Remove duplicate data From table in sqlserver table
本文介绍了如何从sqlserver表中的表中删除重复数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从sqlserver表中的表中删除重复数据
我的表数据:
ID姓名
344B6794 Visal
CA6B5B10 Raghu
9DC012F7 Visal
FDC12AC1 Raghu
9B439B6F Rakesh
F9F7D96A Naresh
A28909C3 Rakesh
我只需要低于数据
ID名称
344B6794 Visal
CA6B5B10 Raghu
9B439B6F Rakesh
F9F7D96A Naresh
如何获取数据......?
有没有人知道这个回复我?
问候
Kishore
解决方案
尝试这个..
SELECT名称,MAX(ID)FROM tablename
GROUP BY名称
这个链接可以帮到你。
点击这里
在您的情况下,表中没有重复数据,
但如果您只考虑名称作为重复数据,那么您可以通过以下方式获得不同的数据...
选择 MIN(ID),名称来自 tbl_1
group by 名称
或
选择 MAX(ID),名称< span class =code-keyword> from tbl_1
group by 名称
根据您的要求选择以上任何一项。
希望它会有所帮助。
How to Remove duplicate data From table in sqlserver table
My table Data :
ID Name 344B6794 Visal CA6B5B10 Raghu 9DC012F7 Visal FDC12AC1 Raghu 9B439B6F Rakesh F9F7D96A Naresh A28909C3 Rakesh
I need to get below data only
ID Name 344B6794 Visal CA6B5B10 Raghu 9B439B6F Rakesh F9F7D96A Naresh
How can i get the data...?
Could any one know about this Reply me ?
Regards
Kishore解决方案Try this one ..
SELECT Name, MAX(ID) FROM tablename GROUP BY Name
This link should help you.
Click Here
well in your case there is no duplicate data in table,
but if you consider only names as duplicate data then you can get distinct data in following ways...
select MIN(ID), Name from tbl_1 group by Name
or
select MAX(ID), Name from tbl_1 group by Name
choose any of above according to your requirement.
hope it will help.
这篇关于如何从sqlserver表中的表中删除重复数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文