Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Delete duplicate records from table.

Author  Topic 

hspatil31
Posting Yak Master

182 Posts

Posted - 2012-05-16 : 02:05:09
Dar All,

In my table I have following data. I want to delete duplicate records from table.

I am trying following SQL statement, So I am getting
desired output. I want to keep the desired output records and other all should be deleted.

select C1,C2,C3,C4,COUNT(*) from table_Delete
group by C1,C2,C3,C4
having COUNT(*) >= 1
ORDER BY COUNT(*) DESC

Can anyone please tell me how to resolve this issue ?

C1 C2 C3 C4

201 203 224 325E

201 203 224 325E
201 203 224 325E
201 203 224 325E
201 203 224 325E

201 203 224 389C

201 203 224 325E

Desired Output:

C1 C2 C3 C4
201 203 224 325E 6
201 203 224 389C 1


Thanks and Regard's
Harish Patil

Sachin.Nand

2937 Posts

Posted - 2012-05-16 : 02:16:11
Do you want Spoon feeding or would you like to make some effort ? If its latter then http://lmgtfy.com/?q=how+to+delete+duplicate+rows+sql+server

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page

hspatil31
Posting Yak Master

182 Posts

Posted - 2012-05-16 : 02:26:02
Dear Friend,

If you don't know the answer then please don't reply like this.
Dump person.

Thanks and Regard's
Harish Patil
Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2012-05-16 : 02:32:48
quote:
Originally posted by hspatil31

Dear Friend,

If you don't know the answer then please don't reply like this.
Dump person.

Thanks and Regard's
Harish Patil



I am not surprised by you reply..

You are not making any god damn effort to use your brain to find the answer.So I think it is quite easily understandable who the dump person here is...Good day..

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page
   

- Advertisement -