Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Missing numbers
Message
From
13/04/2005 13:55:47
 
 
To
13/04/2005 06:06:44
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows '98
Network:
Windows 98
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01004075
Message ID:
01004284
Views:
15
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform