Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Coding puzzle 3
Message
De
06/06/2002 06:11:14
Walter Meester
HoogkarspelPays-Bas
 
 
À
06/06/2002 05:55:41
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00665235
Message ID:
00665323
Vues:
35
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,
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform