Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace record from other dbf
Message
From
11/03/2005 12:13:53
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00994807
Message ID:
00994891
Views:
18
Dear Khubaib

Put one the following routines to delete duplicate records

Example 1

valid procedure for Txtcustid:
cCustid = Alltr(this.value)
Select("Customers")
Set order to tag CUSTID
GO TOP
IF !EOF() .OR. !BOF()
Set Exact on
Seek(cCustid)
If Seek(cCustid)
Messagebox("Duplicate records or records exist!",0+16,"Add",1900)
return 0
Endif
Set exact off
Endif

EXE 2

SELECT * ;FROM table A ;WHERE EXISTS ; ( SELECT * ; FROM table B ; WHERE B.key = A.key; GROUP BY key ; HAVING COUNT(*) > 1 ) ;ORDER BY fieldlist
or
SELECT * ;FROM table ;WHERE key IN ; ( SELECT key ; FROM table ; GROUP BY key ; HAVING count(*) > 1) ;ORDER BY fieldlist

Exe – 3

To find number of dulplicates use following line:

SELECT COUNT(*) FROM myTable GROUP BY myKeyField_or_myExpression HAVING COUNT(*) > 1

Wish you good luck
Allah Hafiz
Previous
Reply
Map
View

Click here to load this message in the networking platform