如何避免选择查询中的重复记录 [英] how to avoid duplicate records in Select Query
本文介绍了如何避免选择查询中的重复记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HEllo团队,
我有如下表:
表名:Qwner
ownername是其中一个。
所有者名称
Harshal
harshal
汤姆
Sandip
Harshal
表中有重复记录。我想避免重复记录。我尝试了不同的,但没有用。请指导我......你有任何其他选择。
谢谢
Harshal
HEllo Team,
I have table as follows:
Table Name : Qwner
ownername is one of the column.
OwnerName
Harshal
harshal
Tom
Sandip
Harshal
There are duplicate records in table . i want to avoid duplicate record .As i have try with distinct ,but no use..Please guide me..Do u have any other options.
Thanks
Harshal
推荐答案
尝试:
Try:
SELECT DISTINCT OwnerName FROM Qwner
当我用你的数据测试时,对我来说工作正常...
Works fine for me when I test it with your data...
DISTINCT,如 InsertCleverUserName [ ^ ]是你想要的,除非你有一个唯一的标识符。
DISTINCT, as mentioned by InsertCleverUserName[^] is what you want, unless you have a unique identifier.
SELECT DISTINCT OwnerName FROM Owner
这篇关于如何避免选择查询中的重复记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文