Skip to content
WJunction - Webmaster Forum

Dupe sql records

Status
Not open for further replies.
mind the scribbles in the SS, i iz not good freehand btw

[slide]http://i.lulzimg.com/6fea8e0350.png[/slide]

how to remove dupes, iv fixed the mod tht did this
 

7 comments

FIRST OF ALL BACKUP UR DB

well am not sure, I thought about
delete table_name where id not in (select distinct id from table_name)

but then i thought it wont distinct out "sitename" field
let me think someway out...if I couldnt do it via query we would design a php code to do it which would make it easy tbh
 
FIRST OF ALL BACKUP UR DB

well am not sure, I thought about
delete table_name where id not in (select distinct id from table_name)

but then i thought it wont distinct out "sitename" field
let me think someway out...if I couldnt do it via query we would design a php code to do it which would make it easy tbh


You can't delete from a table in a select from the same table. Mysql won't allow it.

You should never offer a novice mysql commands without knowing the exact table and field names involved in the command.......

Especially ones that you are not sure and have not tested on your test table!!!!!!!!!!!
 
1. Backup the database (in case any problem occurs, though we would be already backing up the database in this way too)

2. Rename the table to old_backup (Dont forget to keep your site offline for the timebeing)

2. Open PHPMYADMIN --> Select the table and execute this query:

PHP:
CREATE TABLE `original_table_name_here` as SELECT * FROM `renamed_name` WHERE 1 GROUP BY `url`

Replace original_table_name_here with the old table name you had and renamed_name to the name you just renamed above

I have tested doing same with DLE script to remove fucking duplicate posts. And it did worked successfully.
 
Status
Not open for further replies.

About the author

C
Banned · Joined
901
Messages
17
Reactions
18
Points
Grow your business

Advertise on WJunction

Connect with an established international community of webmasters, hosting providers, developers and online entrepreneurs.

  • Premium & Premium+ Sticky
  • Dedicated section banners
  • Site-wide banner advertising
Explore advertising options
Back
Top Bottom