My table has a column, "Company_Name", like company_A, company_B, etc. I want another column, "Company_ID", where each company will have an integer ID starting with 1 and auto-incremented whenever company name changes.
Note that the Company_Name is not the primary key in my table. So, there will be multiple entires of a company name (and I cannot do a simple auto_increment for the company ID).
For example:
company_A
company_A
company_A
company_B
company_B
should yield
1
1
1
2
2