📅  最后修改于: 2022-03-11 15:05:23.101000             🧑  作者: Mango
SELECT * FROM (
SELECT x, (SELECT min(x) FROM my_table t2 WHERE t2.x > t.x) next_x
FROM my_table t
) WHERE x <> next_x - 1;
/* if my_table contains for x: 1 2 5 6 7 10
X NEXT_X
2 5
7 10
*/
-- ⇓ Test it ⇓ (Fiddle source link)