General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only