primary key 不能有重複的值吧?多年不玩,有點忘了。

I may try this;
For the safety of the data, copy the table data into a EXCEL worksheet.
Insert a colume by the Order_ID (colume B), insert a row under the colume label row. In the first cell (B2)of the new colume under the colume label, type: max(first cell:last cell of the ORDER_ID colume, eg. A3:A10000).
In cell B3, type: =IF(B3=0,MAX(C$2:C2)+1,B3).
Copy the cell B3 and paste to B4:B10000.
All the Order_id that was 0 will become one greater than the maximum id before it.
After check the result, delete the old ir colume, delete the row under the label row and replace the old data table in the database.

請您先登陸,再發跟帖!