Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting duplicate records
Message
From
14/04/1999 12:49:26
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Deleting duplicate records
Miscellaneous
Thread ID:
00208276
Message ID:
00208276
Views:
60
Hello

Im trying to write a program to delete duplicate records from
a couple of database tables.
I've has some help with this code but it doesn;t seem to be removing my records. Any input would be appreciated.
close all
set defa to \wincats\data

use act_plan

Select sin, add_date, add_time, count(*) as counter from Act_plan;
Into Cursor Temp ;
group by 1,2 ;
having count(*) > 1

Select Act_plan
set order to Sin

Select temp

Scan
If Seek(temp.sin + dtoc(temp.add_date) + temp.add_time , "Act_Plan") = .t.
Skip in Act_plan
nDeleterecords = temp.counter-1
Delete Next nDeleterecords In Act_plan
Pack
Endif
Endscan
close all
set defa to \wincats\data
use coun_dtl

Select sin, add_date, add_time, count(*) as counter from coun_dtl;
Into Cursor Temp1 ;
group by 1,2 ;
having count(*) > 1

Select coun_dtl
set order to Sin

Select temp1

Scan
If Seek(temp1.sin + dtoc(temp1.add_date) + temp1.add_time , "coun_dtl") = .t.
Skip in coun_dtl
nDeleterecords = temp1.counter-1
Delete Next nDeleterecords In coun_dtl
Pack
Endif
Endscan
Next
Reply
Map
View

Click here to load this message in the networking platform