elioncho Posted October 9, 2006 Share Posted October 9, 2006 HI, I have a table that looks something like this:CREATE TABLE orders( ID INT(5) AUTO_INCREMENT NOT NULL, name VARCHAR(40) NOT NULL, date DATE NOT NULL,PRIMARY KEY(ID,date) )I want to change the value of ID to 1 again after certain time. What MySQL query can I use to make the field ID begin autoincrementing from number 1 again. Thanks.. Quote Link to comment Share on other sites More sharing options...
AndyB Posted October 9, 2006 Share Posted October 9, 2006 Why would you want to do that? The auto-increment value is an intrinsic part of the database, not some field you should manipulate at will. Quote Link to comment Share on other sites More sharing options...
elioncho Posted October 10, 2006 Author Share Posted October 10, 2006 Because I want that everytime a new year starts the count to begin at 1. Quote Link to comment Share on other sites More sharing options...
pootlecat Posted October 10, 2006 Share Posted October 10, 2006 It seems you want to know the same thing as me :)I haven't found anywhere on Google that suggests it is even possible but hopefully someone here will know! Quote Link to comment Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 I've posted elsewhere on how to do this, much to my shagrin... if you want to empty out the table properly, TRUNCATE it, and MySQL will take care of the rest. Quote Link to comment Share on other sites More sharing options...
pootlecat Posted October 10, 2006 Share Posted October 10, 2006 I don't know about elioncho but I want to keep my data and just redo the auto_increment column :) Quote Link to comment Share on other sites More sharing options...
fenway Posted October 10, 2006 Share Posted October 10, 2006 The question is "why?"... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.