Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checking duplicate values
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01335071
Message ID:
01335072
Views:
16
This message has been marked as a message which has helped to the initial question of the thread.
Why not use a query?
SELECT * FROM ap WHERE id2 IN (SELECT id2 FROM ap2)  INTO CURSOR crsDupRecs
* or - most likely the fastest one
SELECT ap.* FROM ap JOIN ap2 ON ap2.id2 = ap.id2 INTO CURSOR crsDupRecs
* or
SELECT * FROM ap WHERE EXISTS (SELECT 1 FROM ap2 WHERE ap2.id2 = ap.id2 )  INTO CURSOR crsDupRecs
>Checking duplicate values
>
>I created two cursors
>But it takes too long because VFP has to scan all records in both cursors
>
>It there a better method the this below ?
>
>************************************************************
> SELECT AP
> SCAN
> SELECT AP2
> aax = 0
> SCAN FOR AP2.ID2 = AP.ID2
> aax = aax + 1
> IF aax > 1
> = MESSAGEBOX("Duplicated record")
> endif
> ENDSCAN
> ENDSCAN
> = MESSAGEBOX ("endSCAN")
>**********************************************************
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform