Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scan + count
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01322689
Message ID:
01322694
Views:
11
>I need to find repeated records in a table
>
>I am using scan + count as below, but looks like count stops scan process
>Scan does not go beyond the first record
>
>
>SELECT TEST11
>
> SCAN
> STORE TEST11.ID TO VERR
> COUNT FOR TEST11.ID = VERR TO VERIX
> IF VERIX > 1
> = MESSAGEBOX ("DUPLICATE RECORD" + STR (VERR))
> ENDIF
> ENDSCAN
>
select test11.id, count(*) as cnt from test11 group by 1 having cnt > 1
Your scan fails for you are moving the pointer (with count) inside the scan, you should save the recno before count and restore it after count to be able to use it, which of course will have a lot of overhead
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform