Skip to content

Instantly share code, notes, and snippets.

@idettman
Created May 11, 2016 22:45
Show Gist options
  • Select an option

  • Save idettman/88115c08e2fe051295f18e7370a9812c to your computer and use it in GitHub Desktop.

Select an option

Save idettman/88115c08e2fe051295f18e7370a9812c to your computer and use it in GitHub Desktop.
INSERT INTO iad_blitz.test (c)
SELECT (MAX(self_selection.c) + 1)
FROM iad_blitz.test AS self_selection
WHERE NOT EXISTS (
SELECT self_does_not_exist.c
FROM iad_blitz.test AS self_does_not_exist
WHERE self_does_not_exist.c=4
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment