Created
November 1, 2016 15:38
-
-
Save nosmall/8095a247566d267536454f585bc487a3 to your computer and use it in GitHub Desktop.
SQL get first free ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(SELECT MIN(t1.UID + 1) AS id FROM task_read t1 LEFT JOIN task_read t2 ON t1.UID + 1 = t2.UID WHERE t2.UID IS NULL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment