Re: [firebird-support] Firebird get the list with all available id

2013-01-29 Thread Virna Constantin
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 > >SELECT t1.id + 1 >FROM table t1 >WHERE NOT EXISTS ( >    SELECT * >    FROM

RE: [firebird-support] Firebird get the list with all available id

2013-01-29 Thread Leyne, Sean
> 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 > > 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

RE: [firebird-support] Firebird get the list with all available id

2013-01-29 Thread Svein Erling Tysvær
>> 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 >> >> 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. I

RE: [firebird-support] Firebird get the list with all available id

2013-01-29 Thread Leyne, Sean
SET, > >> 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 > >> > >> SELECT t1.id + 1 > >> FROM table t1 > >> WHERE NOT EXISTS ( > >> SELECT * > >> FROM table t2 > >> WHERE t2.id = t1.id + 1 > >> ) > >> > >> but it

RE: [firebird-support] Firebird get the list with all available id

2013-01-29 Thread Leyne, Sean
> Once again, your keen I found an error! I swear, English is my mother tongue. Although, from the above, you'd never know it! Once again, your keen *eye* found an error!

RE: [firebird-support] Firebird get the list with all available id

2013-01-29 Thread Helen Borrie
At 09:34 a.m. 30/01/2013, Leyne, Sean wrote: >> Once again, your keen I found an error! > >I swear, English is my mother tongue. Although, from the above, you'd never >know it! > >Once again, your keen *eye* found an error! ...and here was eye, thinking you were using Dragon NS to compose your e

RE: [firebird-support] Firebird get the list with all available id

2013-01-30 Thread Svein Erling Tysvær
>If we are going the EXECUTE BLOCK approach, which I agree would be better. > >Then, the optimal logic would be: > >execute block returns (id integer) as >declare variable Next_ID integer; >begin > ID = 1; > FOR >SELECT ID >FROM Table >ORDER BY ID >