adspace


if 3 duplicate records, by keeping one original and one
duplicate record, and how to delete remaining 2 duplicates in
sql server 2008

Answer Posted / Bijendra Singh

In SQL Server 2008, you can use the ROW_NUMBER() function to keep one original and one duplicate record, and then delete the remaining two duplicates. Here's an example:nn```sqlnWITH CTE AS (n SELECT *, ROW_NUMBER() OVER(PARTITION BY [column1], [column2] ORDER BY [column1]) as rownumn FROM your_tablen)nDELETE FROM CTE WHERE rownum > 2;n``

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If u need any fake experience certificate in software side, contact me at: vikramyadhav@gmail.com

8421


Explain the types of operations? Draw the figure for shift and rotate operations?

3427


I want sample papers for NIC Examination. Plz send them to my mail Id das.neelam@gmail.com . Plz send it today, tomorrow i've the exam.

2110


what is the diff bw sql direct and jdbc update can't we do select and updating operation in sql direct

2242


hi This is radhika.Can anyone help me to know the question papers of NATIONAL INFORMATICS CENTRE for the post of scientific officer/engineer? if anyone know plz tell me question paper pattern

2184


hi, all this is shoba m.c.a . i have learned abap but no oppurtunities right now as fresher , right now i want to learn any course on demand any one pls suggest me good course and institute in hyderabad

1882


I am taking the bmc control m/enterprise manager 7.0 scheduling test and just wanted to see what kind of questions they would ask or if anyone has taken the test and how long it is for how many questions?

6221


Hi Guys, This is Rama, right now I am working as a Software Test Engineer in Gurgoan and I have over all 3 years of testing expoeriance. Right now I am looking for a change. Can any body help me out to find a job in south india. Thanks in Advance

1958


How to get the index of the clicked field in reports in ABAP?

1773


Mainly Related to Oracle, DBMS , Oracle Stored Procedures, Functions, Oracle 9i Architecture, Redo logs..., Views,

2414


Compare any 4 software development life cycle paradigms with each other. Indicate at least one application for each of the paradigms that are suitable to developed using that paradigm.

2912


Bonjour, svp je veut voir comment envoyer un mail en java et comment changer le droit d'accé d'un fichier en java: de lecture en lecture/écriture et merci d'avance ;)

2313


please any one pass file aid,xpeditor and endeavor tools

2421


Please forward important interview and basic questions in VB6 on my email id: usneha_16@yahoo.co.in

2117


Give examples of macro quoting function?

2075