VFP中如何查找表中重复的记录
SELECT * FROM 表名 WHERE 字段名 IN (SELECT 字段名 FROM 表名 GROUP BY 字段名 HAVING count(*)>1) order by 字段名
*1. 查询单个字段重复的记录,并删除重复记录的行
SELECT * FROM T WHERE B IN (SELECT B FROM T GROUP BY B HAVING COUNT(B)>1) ORDER BY B
DELETE T FROM (SELECT * FROM T WHERE ;
B IN (SELECT B FROM T GROUP BY B HAVING COUNT(B)>1) ;
AND A NOT IN (SELECT MIN(A) FROM T GROUP BY B HAVING COUNT(B)>1)) A WHERE T.A=A.A
MESSAGEBOX(_TALLY)
[ 本帖最后由 sdta 于 2014-1-28 23:47 编辑 ]