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
What is $_ server request_method == post?
How to get useful error messages in php?
How do I find out the number of parameters passed into function9?
How do you use an array in excel?
How to check curl is enabled or not in PHP
Which function is used in php to check the data type of any variable?
How can we display the output directly to the browser?
Explain me what is x+ mode in fopen() used for?
Why is php used?
Which is correct about mysqli and pdo?
What version of php do I have windows?
Is nan in php?
Which software is used to run php programs?
What is the use of super-global arrays in php?
What is uri routing?