Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Missing numbers
Message
De
13/04/2005 13:55:47
 
 
À
13/04/2005 06:06:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Divers
Thread ID:
01004075
Message ID:
01004284
Vues:
16
>Dear Sir,
>
>Field1 of Table1 is numeric type and has data as follows
>
>1
>2
>5
>6
>8
>7
>10
>
>How to findout missing numbers, within dbf field, programatically?
>
>Please help

Take a look starting at Message #319727 . I got this from Walter Meester about 5 years ago. Here's a sample to show it works:
CREATE CURSOR sequence (nval n(3,0))
INSERT INTO sequence VALUES (1)
INSERT INTO sequence VALUES (2)
INSERT INTO sequence VALUES (4)
INSERT INTO sequence VALUES (5)
INSERT INTO sequence VALUES (6)
INSERT INTO sequence VALUES (9)
INSERT INTO sequence VALUES (11)
INSERT INTO sequence VALUES (12)
INSERT INTO sequence VALUES (15)

SELECT x.nval+1 gapstart, MIN(y.nval)-1 AS gapend ;
       FROM sequence x, sequence y ;
       WHERE x.nval < y.nval ;
       GROUP BY x.nval ;
       HAVING gapend - x.nval >= 1
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform