Hi there,
I have developed an application, where the main table, Jobmain, has got JobID, key, auto_increment.
Now an ASP page allows users to create new jobsheets online and shows them the jobID on the page.
To get the JobID before it is inserted I used
select 1+max(jobid) from jobmain and it usually works, but if you delete a record then it does not show the correct ID anymore.
I then tried to avoid this using
select 1+jobid from jobmain order by jobid desc limit 1
but surprisingly I still get the same error.
MySQL seems to ignore the deleted records but does not re-assign the same ID to the next one.
What else can I try?
Thanks
Qatqat
Life is what happens when you are making other plans.
I have developed an application, where the main table, Jobmain, has got JobID, key, auto_increment.
Now an ASP page allows users to create new jobsheets online and shows them the jobID on the page.
To get the JobID before it is inserted I used
select 1+max(jobid) from jobmain and it usually works, but if you delete a record then it does not show the correct ID anymore.
I then tried to avoid this using
select 1+jobid from jobmain order by jobid desc limit 1
but surprisingly I still get the same error.
MySQL seems to ignore the deleted records but does not re-assign the same ID to the next one.
What else can I try?
Thanks
Qatqat
Life is what happens when you are making other plans.