Hi,
I'm trying to get the current ai value for a table. I've had a read up on the docs, and they suggest using
SELECT LAST_INSERT_ID();
I want to do this on a specific table though. I've tried just doing SEELCT MAX(ID) , but that doesn't always work (for example, if the last record in the table is ID 20, but the auto inciment value is set at 22 (due to deleting a record), it only return:
20 + 1 (which would give the new row number)
Any suggestions?
If I can't work out a way to do that - I guess I'll just have to rethink the code that does this
TIA
Andy
I'm trying to get the current ai value for a table. I've had a read up on the docs, and they suggest using
SELECT LAST_INSERT_ID();
I want to do this on a specific table though. I've tried just doing SEELCT MAX(ID) , but that doesn't always work (for example, if the last record in the table is ID 20, but the auto inciment value is set at 22 (due to deleting a record), it only return:
20 + 1 (which would give the new row number)
Any suggestions?
If I can't work out a way to do that - I guess I'll just have to rethink the code that does this
TIA
Andy