Skip to content

Instantly share code, notes, and snippets.

@cupen
Last active August 29, 2015 14:06
Show Gist options
  • Save cupen/701adfa44f58ae25c506 to your computer and use it in GitHub Desktop.
Save cupen/701adfa44f58ae25c506 to your computer and use it in GitHub Desktop.

Revisions

  1. 咚咔 revised this gist Sep 19, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion just_biang_biang.sql
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,8 @@ SELECT
    t2.i as idx2

    FROM
    test as t1 LEFT JOIN test as t2 ON (t1.i - t2.i) = 1
    test as t1
    LEFT JOIN test as t2 ON (t1.i - t2.i) = 1

    WHERE
    ISNULL(t2.i);
  2. 咚咔 revised this gist Sep 19, 2014. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions just_biang_biang.sql
    Original file line number Diff line number Diff line change
    @@ -6,14 +6,13 @@ DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci


    SELECT
    t1.i as idx1,
    t2.i as idx2
    t1.i as idx1,
    t2.i as idx2

    FROM
    test as t1
    LEFT JOIN test as t2 ON (t1.i - t2.i) = 1
    test as t1 LEFT JOIN test as t2 ON (t1.i - t2.i) = 1

    WHERE
    ISNULL(t2.i);
    ISNULL(t2.i);


  3. 咚咔 created this gist Sep 19, 2014.
    19 changes: 19 additions & 0 deletions just_biang_biang.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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);