On 3 Sep 2012, at 7:53am, YAN HONG YE <[email protected]> wrote:

> my database have a column named id auto_increament inter primary key,  when I 
> delete any rows , the id item may be indiscriminate , how to update it and 
> reorder the 
> column from 1 to max(id) order by id asc?

Can you think through why you're trying to do this ?  Is there really any point 
in keeping such a number that might change ?  Is it necessary that there be no 
missing numbers in your sequence ?  What would you use this number for ?

If you have a table related to this table, then every time you change 'id' in 
this table, you must change the related column in your other table.

If you just need to know how many rows you have, you can use

SELECT count(id) FROM myTable

If you need the rows numbered, you can just number them in your software when 
you produce the list.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to