Register now or log in to join your professional community.
Hi,
Add primary key in your table then you can easily remove duplicate entry.
Example:-
DELETE FROM master_table WHERE id IN (SELECT * FROM (SELECT id FROM master_table GROUP BY master_id, master_quiz, master_question, master_ans HAVING (COUNT(*) >1) ) AS A);
Hope this help.
we insert auto increment on id column then run following command:
delete * from table_name where id > min(id) group by(column1,column2...collumnN) excluding column id
For example, with the following data:
SELECT*FROM names; +----+--------+| id | name |+----+--------+|1| google ||2| yahoo ||3| msn ||4| google ||5| google ||6| yahoo |+----+--------+I would use SELECT DISTINCT name FROM names; if it were a SELECT query. How would I do this with DELETE to only remove duplicates and keep just one record of each?