> I have a table, with 4 columns. One of the column is
> ID, a Primary Key, which has Auto_Increment set on it.
>
>
> Now i have a lot of rows deleted and a lot of
> duplicate rows that will be deleted, and all sorts of
> stuff happening in the table.. the result is, that the
> IDs have become i
> What i want to do is delete the entire IDs and
> generate them again so that they are in one single
> order like 1,2,3,4,5... .like this.
I suspect that if your table, as you use it, needs this ordering then
you've got something wrong. It really shouldn't matter much what the
internal IDs
, but from the place you deleted on higher
> you need to decrement the
> id values by one.
>
> try this from the mysql command line on a test table
> with some fake records,
> and you should see what i mean...
>
> good luck
> jack
>
> -Original Message-
>
say you have 100 records.
you delete number 36.
your db will then be
...
34
35
37
38
...
correct?
after a delete, you could then say:
update table set id_num=id_num-1 where id > 36
and this would update all relevant records
-Original Message-
From: Thomas Edison Jr. [mailto:[EMAIL PROTEC
4 matches
Mail list logo