April 26, 2013 at 9:40 am
I have a table of contacts that has no unique key on it. The users have entered multiple copies of several people's information and I want to remove the duplicate values.
Here are the column names
Last_Name, First_NAme, Department, Email, phone, Sid (sid can be null)
Please help-
April 26, 2013 at 9:45 am
;WITH OrderedRows AS (
SELECT Last_Name, First_NAme, Department, Email, phone, Sid,
rn = ROW_NUMBER() OVER(PARTITION BY Last_Name, First_NAme, Department, Email, phone, Sid ORDER BY (SELECT NULL))
FROM MyTable
)
DELETE FROM OrderedRows WHERE rn > 1
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
April 26, 2013 at 10:40 am
Thank you so much and God bless you! TGIF
April 26, 2013 at 10:59 am
hydbadrose (4/26/2013)
Thank you so much and God bless you! TGIF
You're welcome and Happy Friday to you too!
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply