I have a table with duplicates (COL2) within the same category (defined in COL1), when I try to delete tuples within COL2, I can't find a way to do this only within the same category, instead it deletes tuples everywhere in the table.
Here is the current table T1 BEFORE removing duplicates:
        COL1      COL2
         A         1
         A         2
         A         2
         A         2
         B         1
         B         2
         B         2
         B         3
Here is the current table T1 AFTER removing duplicates:
        COL1      COL2
         A         1
         A         2
         B         3
Here is what I should have in T1:
        COL1      COL2
         A         1
         A         2
         B         1
         B         2
         B         3
Here is the code I used to delete duplicates:
    CREATE TABLE TEMP LIKE T1;
    INSERT INTO TEMP SELECT * FROM T1 WHERE 1 GROUP BY COL2;
    DROP TABLE T1;
    ALTER TABLE TEMP RENAME T1;
Any idea how to tell mysql to delete tuples only within a category of COL1?
 
    