troubleshooting Question

delete a duplicate line or triplicate line and keep one

Avatar of Fordraiders
FordraidersFlag for United States of America asked on
Microsoft SQL ServerSQL
5 Comments1 Solution100 ViewsLast Modified:
Delete duplicate items in table:

I have a table with a field called [LINEITEMID]

IT CONTAINS DUPLICATES


SELECT [PROJECTID]
      ,[SUBMITDATE]
      ,[STARTDATE]
      ,[AUDITEDDATE]
      ,[PROJECTTYPE]
      ,[PROJECTPROORRE]
      ,[ACCOUNTNUMBER]
      ,[NOOFLINEITEMS]
      ,[ACCOUNTTYPE]
      ,[SKU]
      ,[SEARCHSTATUS]
      ,[U_TYPE]
      ,[UPDATEDBY]
      ,[NOOFBOTHMFGPRESENT]
      ,[NOOFDESCRIPTION]
      ,[NOOFGRAINGERSKU]
      ,[NOOFMFGNAME]
      ,[NOOFMFGPARTNUMBER]
      ,[NOOFSPELLERRORMFGNAME]
      ,[AVGNOOFWORDSPERLINE]
      ,[ACCTTYPE]
      ,[PARENTTRACKCODE]
      ,[ADMINCONVERTEDDATE]
      ,[ADMINLINECONVERSION]
      ,[ADMINTIME]
      ,[ADMINRACFID]
      ,[COMPANYNAME]
      ,[CRMACCOUNTTYPE]
      ,[ADMINCONVERSIONTYP]
      ,[SLATYPE]
      ,[AUTOMATCH]
      ,[POSTCOUNTS]
      ,[MANUALMATCH]
      ,[EXCPETION_DIRECT]
      ,[AUDITEDBY]
      ,[ASSIGNEDBY]
      ,[PROJECTASSIGNTO]
      ,[QUALIFIEDLINES]
      ,[QUEUEACCOUNTTYPE]
      ,[QUEUENAME]
      ,[SEGMENT]
      ,[SELLERSRACFID]
      ,[SLADATE]
      ,[SPLITPROJECT]
      ,[STATUS]
      ,[TOTAL_EXPENSE]
      ,[BRANDNUMBER]
      ,[LASTMODIFIED]
      ,[LINEITEMID]
      ,[LINEITEMRESID]
      ,[MATCHEDROWID]
      ,[MFGNAME]
      ,[MFGPARTNUMBER]
      ,[MGRCODE]
      ,[POSTTYPESEARCH]
      ,[SALESSTATUS]
      ,[SUPPLIERNUMBER]
      ,[UPDTTYPE]
  FROM [Metrics].[dbo].[ORACLE_EXT]
  
  where [LASTMODIFIED] >= '2019-01-01'


What I need I need to dlete the duplicate line but keep one good ;line


The data looks like this

[LINEITEMID]
2234
2235
2236
2236
2237
2237
2237
2238
2239
2240...etc..

Thanks
fordraiders
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 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 5 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