Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
260 views
in Technique[技术] by (71.8m points)

database - Distinct or Union is selecting duplicate data in SQL Server

I have a table with 526 rows and has lot of duplicate data. For removing duplicate I used this script:

select distinct fullname, RegistrationNumber
from tbllookupStudentInfo1;

I got 291 rows, but it still has duplicate column so I tried using union:

select distinct fullname, RegistrationNumber
from tbllookupStudentInfo1
union 
select fullname,RegistrationNumber
from tbllookupStudentInfo1;

I got 291 rows, but still I am getting few duplicate value. And then I select just Fullname using both union and distinct and got 213 rows which consists few duplicate fullname too. How should I solve this?

enter image description here

question from:https://stackoverflow.com/questions/65643343/distinct-or-union-is-selecting-duplicate-data-in-sql-server

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...