Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > MySQL
|
MySQL General discussion about the MySQL database.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the MySQL section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 19th, 2006, 09:52 AM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default delete duplicates rows

hi,
i have a table with mora than 12000 registries and aprox. 1000 duplicated, how can i delete them with a sql command?
thanksss
 
Old June 19th, 2006, 11:55 AM
Authorized User
 
Join Date: May 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to guillermo
Default

http://support.microsoft.com/default...b;en-us;139444

I know it says it works for SQL Server, but ignore that. If you use SQL to talk to your db, then that solution applies to you, too.

 
Old June 20th, 2006, 12:24 AM
Authorized User
 
Join Date: Mar 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this work out-

select unique records and store them in some temporary table.
Then drop your table containing duplications.
again create a table of original name from temporary table.

sql> create table TMP select distinct * from YOUR_TABLE;
SQL>drop table TMP; //or truncate
sql> create table YOUR_TABLE select * from TMP;


Best Regards
Milind







Similar Threads
Thread Thread Starter Forum Replies Last Post
How can you delete duplicate rows without using te subhasischakraborty SQL Server 2000 15 October 19th, 2007 06:51 AM
delete rows miguel.ossa C# 1 August 26th, 2004 12:58 AM
Delete duplicates? boson SQL Language 2 August 11th, 2004 04:47 PM
Checking Duplicate values and delete rows ppenn Excel VBA 2 February 3rd, 2004 06:57 AM
Delete rows with macro? Jessica7 Beginning VB 6 1 October 15th, 2003 05:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.