I have a table with id(key).
I was generated a lot of rows. However some rows where not stored because transactions were not completed.
I have total 44000 of rows: first id is 1 & last id is 44045. How could I find ids of 44 absent rows?
I have a table with id(key).
I was generated a lot of rows. However some rows where not stored because transactions were not completed.
I have total 44000 of rows: first id is 1 & last id is 44045. How could I find ids of 44 absent rows?
You can try something like below, to get the rows where no other row with an ID less 1 that the ID of the current row exists and where the ID is not the minimum (which cannot have a predecessor).
SELECT * FROM elbat t1 WHERE NOT EXISTS (SELECT * FROM elbat t2 WHERE t2.id = t1.id - 1) AND t1.id <> (SELECT min(t2.id) FROM elabt t2);