Skip to content

Instantly share code, notes, and snippets.

@cupen
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cupen/701adfa44f58ae25c506 to your computer and use it in GitHub Desktop.
Save cupen/701adfa44f58ae25c506 to your computer and use it in GitHub Desktop.
nothing
CREATE TABLE `test` (
`i` int(255) NULL DEFAULT 0
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
SELECT
t1.i as idx1,
t2.i as idx2
FROM
test as t1
LEFT JOIN test as t2 ON (t1.i - t2.i) = 1
WHERE
ISNULL(t2.i);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment