Is it possible to delete duplicate records from a table with out using rowid in MYSQL?

Can use rownum.

If possible explain.

regards,

Joe

Showing Answers 1 - 13 of 13 Answers

venkata satya arun kumar

  • May 10th, 2007
 

It is possible to delete duplicate records from table without using rowid.
First way is that if you have not used primary key use primary key which wont allow duplicate rows.

  Was this answer useful?  Yes

deep_pinu

  • Mar 10th, 2008
 

it is pretty easy to delete dublicate rows using UNIQUE index on the table...the column on which you can find out duplicacy of records.

Alter table xyz add unique index (col1,col2,...)

on executing the query Duplicate keys are automatically deleted from the databse.
:) enjoy...

  Was this answer useful?  Yes

Yes it is possible.Please check following syntax:

delete from table1
USING table1, table1 as vtable
WHERE (NOT table1.ID=vtable.ID)
AND (table1.field_name=vtable.field_name)

In above place column name in place of field_name to check duplicate values. If there are more than 2 columns to check, Please modify as follows

delete from table1
USING table1, table1 as vtable
WHERE (NOT table1.ID=vtable.ID)
AND (table1.field_name=vtable.field_name and
table1.field_name1=vtable.field_name1)

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions