Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting Duplicate Records
Message
From
06/04/1998 21:37:06
 
 
To
06/04/1998 18:02:00
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00089997
Message ID:
00090025
Views:
36
>I have a file which is derived from another file 99% of whose records
>were imported from an outside database of part numbers. Of 137000
>records about 500 are duplicates as many as 18 on a single number.
>I wrote the code below to remove the duplicates and it works where
>there are up to 3 duplicates but on the record with larger numbers
>jof dupllicates it will delete say 13 of 15 leaving the 2 identical records
>in the beginning of the duplication. Help.
>
>use d:\stock\stock1.dbf
>do while .not. eof()
>m.check1 =number
>skip 1
>m.check2 = number
>do case
>case m.check1 = m.check2
>delete
>case m.check1 # m.check2
>skip 1
>endcase
>
>enddo
>pack

Hey, If you only take the first matched record, try this:

use d:\stock\stock1.dbf again in 0 alias badStock shared
Select * from badStock ;
group by check1, check2 ;
into Table GoodStock
use in badStock
use in Goodstock

* --- replace it... But pls Backup first!
clear all
Set Safety off
copy file stock1.* to BackupStock1.*
use stock1 exclusive
zap
use stock1 again in 0 shared
select stock1
append from GoodStock
clear all
* --- Once you check no problem for replacement
* Delete file BackupStock1.*
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform