You can delete the duplicate row without using the temporary table. You can use the self join concept.
Suppose we have person table contain 3 columns named id, name, and city.
INSERT INTO person(id,name,city) VALUES
(1,'a', 'aa'),
(2,'b','bb'),
(3,'d','dd'),
(4,'d','dd'),
(3,'a','aa');
Now we have to delete the duplicate row from table.
You can see the duplicate record from following query:
select * from person p1, person p2 where p1.id > p2.id;
Now you can delete duplicate recored using the following query.
delete from person p1, person p2 where p1.id > p2.id;
Hope this will help you.
0 Comment(s)