troubleshooting Question

Remove duplicates on a Table

Avatar of COHFL
COHFLFlag for United States of America asked on
Microsoft SQL Server
27 Comments1 Solution99 ViewsLast Modified:
Hi there,
I have a table that it continuos grow drastically due to an error on an automatic import. I cant control that but I can clean the table removing the duplicates. What would be the best approach?
here is the query that returns the records:
SELECT DISTINCT [RecordID]
      ,[PrintTime]
      ,[PrintBy]
      ,[PrintPages]
      ,[PrintCopies]
      ,[Printer]
      ,[DocumentName]
      ,[Client]
      ,[PaperSize]
      ,[Language]
      ,[Height]
      ,[Width]
      ,[Duplex]
      ,[Grayscale]
      ,[size]
  FROM [[PrinterLog]

I know the RecordId is unique so if I remove that on the select I will give me the records I need but I need to remove them for good.
The Printime is a date time field. but there is not way that records will have the same time, DocumentName ...

I hope this is enough information
Thanks!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 27 Comments.
Join the Community
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 27 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