mysql - auto update of database "id" field -
i having column id , news field. "id" field showing primary key in database.
i want "id" field primary i.e want incremented 1. plus, when delete record table, should start counting deleted number.
ex:- if have 20 records. deleted record 10 15. deleted 5 records, total counting 15 records. want database start 16 again. taking next number i.e record number 21.
any help appreciated. give thanks you.
if want add together row-count rows, add together in select, don't mess auto-increment primary key.
set @pos=1; select @pos:=@pos+1 rowposition, yourtable.* yourtable order yourtable.id ;
this code print table additional row rowposition
numbers rows 1,2,3,...
mysql database
No comments:
Post a Comment