Skip to content

Instantly share code, notes, and snippets.

@antyblin
Created November 30, 2016 09:04
Show Gist options
  • Save antyblin/c79e374a1ee4678a2024e00dac65eb67 to your computer and use it in GitHub Desktop.
Save antyblin/c79e374a1ee4678a2024e00dac65eb67 to your computer and use it in GitHub Desktop.
Compare current autoincrement value with current field value.
SELECT AUTO_INCREMENT
FROM information_schema.tables
WHERE table_name = 'tablename'
AND table_schema = DATABASE( )
UNION
SELECT max(autoincrementfield) from `tablename`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment