Answer Posted / prakash.matte
If we have table 'temp' with columns: id(primary key),
field1, field2, field3, to remove the duplicate (field1,
field2, field3) data we can use either of the below queries
1. delete t1.* from temp t1, temp t2
where t1.id>t2.id and t1.field1=t2.field1 and
t1.field2=t2.field2 and t1.field3=t2.field3;
2. alter ignore table temp ADD UNIQUE INDEX
duprows(field1,field2,field3);
> here we can remove the duprows index by using the
following query:
alter table temp drop index duprows;
we can apply index on the columns as we don't require the
duplicate data, so we don't need to execute the query to
delete the index
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Write a program to display reverse of any number?
What are the options to transfer session ids?
Explain about a search-friendly site looks like?
Is laravel better than codeigniter?
Tell me what does the initials of php stand for?
What are the methods useful for method overloading?
What is php? Why it is used?
Why namespace is used in php?
Which is the best php framework for a beginner?
What is a controller php?
How do I run a php program in dreamweaver?
How we get ip address of client, previous reference page etc?
How to concatenate two strings in php?
What is zend studio for?
How to copy a file?