How to get the last inserted ID of a table, even if the last x record(s) have been deleted?
x can be 1 and can be like 200
How to get the last inserted ID of a table, even if the last x record(s) have been deleted?
x can be 1 and can be like 200
收起
Assuming you're talking about auto incremented IDs:
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 'Table'
This will give you the next increment id. To get the last inserted id just minus 1.
报告相同问题?