Subject | Re: [firebird-support] Firebird get the list with all available id |
---|---|
Author | Virna Constantin |
Post date | 2013-01-29T15:09:59Z |
maybe help you:
http://www.xaprb.com/blog/2005/12/06/find-missing-numbers-in-a-sequence-with-sql/
In a table I have records with id's 2,4,5,8. How can I receive a list with values 1,3,6,7. I have tried in this way
http://www.xaprb.com/blog/2005/12/06/find-missing-numbers-in-a-sequence-with-sql/
In a table I have records with id's 2,4,5,8. How can I receive a list with values 1,3,6,7. I have tried in this way
>[Non-text portions of this message have been removed]
>SELECT t1.id + 1
>FROM table t1
>WHERE NOT EXISTS (
> SELECT *
> FROM table t2
> WHERE t2.id = t1.id + 1
>)
>
>but it's not working correctly. It doesn't bring all available positions.
>
>Is it possible without creating another table?
>