- Delete duplicated mysql rows with no primary key
- user_id category_id
- 1 2
- 1 3
- 1 4
- 1 2
- 2 2
- 2 3
- 2 2
- CREATE TABLE temp SELECT DISTINCT * FROM tablename;
- ALTER TABLE tablename RENAME junk;
- ALTER TABLE temp RENAME tablename;
- insert into new_better_table
- select user_id, category_id from old_table group by user_id, category_id