Hoi peter,
>>
>>SELECT X.un+1, MIN(Y.un)-1 FROM X,X Y ON X.un < Y.un GROUP BY X.un INTO CURSOR Gaps
>>
>Hi Walter, I tried it, although I had to modify your code somewhat. However, the result isn't really an endresult.
I know that it does not quite meets the desired result but this code was in a reaction of sergeys code which does exactly the same but in four statements (or am I missing something). I failed to identify what nadya ment with "find out all missing simple (? oops, what's the correct math term?) numbers", so I can't react on that.
I think it would be impossible to find out all missing numbers in the range in a SQL statement, but depending on the application a cursor of gaps will do. Of course you can exent the solution which will convert the gaps into a cursor of missing numbers like
CREATE CURSOR Invert (un I)
SELECT Xx.un+1 Beg, MIN(Y.un)-1 end FROM Xx, Xx Y WHERE Xx.un < Y.un GROUP BY Xx.un INTO CURSOR Gaps
SCAN
FOR nT = Beg TO End
INSERT INTO Invert VALUES (nT)
ENDFOR
ENDSCAN
Walter,