owner Posted March 4, 2010 Share Posted March 4, 2010 Hello, I am in need of a column where the numbers should be auto incremented if left null, but also allow for duplicate numbers if specified. Is this possible? If not, what would be the best way to go about it? Right now the only way I know I could achieve this is to grab the last inserted id from the last query and then make a second query to update the column of the first one with the same id. Thanks in advance! owner Quote Link to comment https://forums.phpfreaks.com/topic/194075-insert-next-id/ Share on other sites More sharing options...
Twister1004 Posted March 4, 2010 Share Posted March 4, 2010 If you are going to use auto increment, then you can NOT have the same number or leave it null. It will call it a duplicate and disregard that SQL. I don't know exactly how to go about your question though. Quote Link to comment https://forums.phpfreaks.com/topic/194075-insert-next-id/#findComment-1021184 Share on other sites More sharing options...
owner Posted March 4, 2010 Author Share Posted March 4, 2010 Is there a way to copy the value from an autoincrementing column to the second column without the need of the second query? Quote Link to comment https://forums.phpfreaks.com/topic/194075-insert-next-id/#findComment-1021186 Share on other sites More sharing options...
fenway Posted March 4, 2010 Share Posted March 4, 2010 Besides, NULL in an auto-increment field will just insert the next number in sequence anyway. And why would you duplicate information across columns???? Quote Link to comment https://forums.phpfreaks.com/topic/194075-insert-next-id/#findComment-1021455 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.