Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing duplicate data

Status
Not open for further replies.

chainedtodesk

Programmer
Feb 26, 2003
112
US
i am trying to update a main table without duplicate records, but cant seem to get it. here is the code i was trying. i have 32 records in my main table 33 in the testdata. i only want the one record that is different to be in my outfile.

SELECT DISTINCT
dbo.ztestdata.[Member #], dbo.ztestdata.[Last Name], dbo.ztestdata.[First Name], dbo.ztestdata.DOB, dbo.ztestdata.Age,
dbo.ztestdata.[Member Address], dbo.ztestdata.City, dbo.ztestdata.State, dbo.ztestdata.Zip
FROM dbo.ztestdata INNER JOIN
dbo.EDO_MainFile ON dbo.ztestdata.[Member #] <> dbo.EDO_MainFile.[Member #]

thanks
 
Code:
SELECT DISTINCT 
                      dbo.ztestdata.[Member #], dbo.ztestdata.[Last Name], dbo.ztestdata.[First Name], dbo.ztestdata.DOB, dbo.ztestdata.Age, 
                      dbo.ztestdata.[Member Address], dbo.ztestdata.City, dbo.ztestdata.State, dbo.ztestdata.Zip
FROM         dbo.ztestdata left JOIN
                      dbo.EDO_MainFile ON dbo.ztestdata.[Member #] = dbo.EDO_MainFile.[Member #]
where dbo.EDO_MainFile.[Member #] is null
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top