Information générale
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement