Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL quiz. Statement that returns *missing* values
Message
From
14/07/2011 23:03:58
 
 
To
13/07/2011 03:29:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01518034
Message ID:
01518210
Views:
70
>To find the start of all the gaps:
>Select k.numfield+1 as manko From yourtable k;
>   Where k.numfield+1 Not in (Select numfield From yourtable)
>
>
>>A table has an index column that starts at one and goes to N, with some missing values. Is there an SQL Select statement (its ok to use more than one) that will return the first x items that are NOT present in the column?
>>
>>TIA,
>>
>>Alex

That will suit my purpose, Tore, thank you. I will only be only looking for the first gap which I will use as the next id (in case somehow the value on the "next index" table has gone over the top). Hope it runs fast.

Alex
Previous
Reply
Map
View

Click here to load this message in the networking platform