Jak znaleźć luki w numeracji w bazie MySQL i PostgreSQL?

SELECT id + 1 available_id
FROM customers t
WHERE NOT EXISTS
    (SELECT *
     FROM customers
     WHERE id = t.id + 1 )
ORDER BY id

https://stackoverflow.com/questions/1312101/how-do-i-find-a-gap-in-running-counter-with-sql

Leave a Reply

Your email address will not be published. Required fields are marked *