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.
| Author |
Topic |
|
Joshrinn
Posting Yak Master
118 Posts |
Posted - 2012-06-13 : 08:17:00
|
| How can I delete duplicate rows from my table. Can you please post the query with imaginary table name |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-06-13 : 08:26:22
|
[code]declare @Sample table(id int, txt varchar(30))insert @Sampleselect 1, 'A' union allselect 1, 'B' union allselect 2, 'C' union allselect 3, 'D'select * from @Sampledelete dtfrom(select row_number() over (partition by id order by txt) as rn,* from @Sample)dtwhere rn > 1select * from @Sample[/code] No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
dattatreysindol
Starting Member
20 Posts |
Posted - 2012-06-13 : 08:49:17
|
| Hi Joshrinn,Please take a look at the following article for various different ways to delete duplicate rows from a table.[url]http://www.mssqltips.com/sqlservertip/1918/different-strategies-for-removing-duplicate-records-in-sql-server/[/url]Dattatrey Sindol (Datta)http://dattatreysindol.com/This information is provided "AS IS" with no warranties, and confers no rights. |
 |
|
|
jimoomba
Yak Posting Veteran
90 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-13 : 10:20:44
|
quote: Originally posted by Joshrinn How can I delete duplicate rows from my table. Can you please post the query with imaginary table name
what according to you're duplicatesfirst define that by means of sample data and show us what you want as output.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|