CREATE TABLE #TempDuplicateRows
(Id INT
,Names varchar(49)
,Addresses varchar(249)
)
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 1,'Peter','USA')
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 2,'John','UK' )
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 3 ,'Abhi', 'India')
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 2,'John','UK')
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 4,'Red','USA')
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 5,'Andry','Uk')
INSERT INTO #TempDuplicateRows(Id,Names,Addresses)
VALUES ( 3 ,'Abhi', 'India')
SELECT * FROM
(
Select ROW_NUMBER() Over(Partition by Names Order by Id) as 'Row',*
FROM #TempDuplicateRows
) as tbl where Row = 1
DROP TABLE #TempDuplicateRows