How to use the counter in the UPDATE statement For example, I have some duplicate records in the column as follows:
-------------------- Ref_Number ----- --------------- 108001798914 108001798914 108001798914 108001798914 108001798914 108001798914
How to remove duplication so that the result should be
------------------ - Ref_Number -------------------- 108001798914 108001798915 108001798916 108001798917 108001798918 108001798919
Try it before your running Do not forget to make a backup of the interview:
Create table template as my table; Add optional table temp_table UNIQUE (Ref_Number); Optional table temp_table change Ref_Number Ref_Number INT (10) AUTO_INCREMENT primary key; Insert Temp_table (except for all, other, fields, refnumber, here) my_table TRUNCATE my_table, except for all, field, select refnumber; Add optional table my_table UNIQUE (Ref_Number); Optional table my_table change Ref_Number Ref_Number INT (10) AUTO_INCREMENT primary key; Include in my_table selection * to temp_table DROP temp_table;
This is a sample
Comments
Post a Comment