How to find “holes” in a table

后端 未结 10 2218
野趣味
野趣味 2020-12-24 04:28

I recently inherited a database on which one of the tables has the primary key composed of encoded values (Part1*1000 + Part2).
I normalized that column, but I cannot ch

10条回答
  •  悲&欢浪女
    2020-12-24 04:53

    SELECT (ID+1) FROM table AS t1
    LEFT JOIN table as t2
    ON t1.ID+1 = t2.ID
    WHERE t2.ID IS NULL
    

提交回复
热议问题