troubleshooting Question

Delete a single duplicate from a pair of duplicates SQL query

Avatar of Bevos
Bevos asked on
Microsoft AccessMySQL Server
6 Comments1 Solution198 ViewsLast Modified:
Hello, I have a query that finds duplicate values from my database but doesnt' do anything about them.  I would like someone to show me how to change the code so that only a single record of the duplicates remains.  I don't care which one, because these are all functionally identical entries.  

Thanks,
Bevo



SELECT DISTINCT First(Imported.Author2) AS [Author2 Field], First(Imported.Year) AS [Year Field], First(Imported.TitleShrt) AS [TitleShrt Field], First(Imported.Volume) AS [Volume Field], Count(Imported.Author2) AS NumberOfDups
FROM Imported
GROUP BY Imported.Author2, Imported.Year, Imported.TitleShrt, Imported.Volume
HAVING (((Count(Imported.Author2))>1) AND ((Count(Imported.Volume))>1));

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros