读书人

小弟我用vf6编写了个程序 现在想在一个

发布时间: 2012-03-16 16:34:56 作者: rapoo

我用vf6编写了个程序 现在想在一个表中判断是否有重复数据并删除重复数据 请问该怎么做?
我用vf6编写了个程序 现在想在一个表中判断是否有重复数据并删除重复数据 请问该怎么做?

我的表名称为JBDATA 其中有XM ZH DW DWCP XH 等字段 现在想依据ZH字段把重复数据筛选掉并把筛选后的数据保存在本表中 请问改怎么做?
数据表内容如下
XM ZH DW DWCP XH
a 1 qw 2 1
b 2 re 1 2
c 3 rt 1 3
a 1 qw 2 4
b 2 re 1 5


请问该怎么操作 谢谢!!!!!!!!!!!

[解决办法]
use jbdata
index on zh to sy
total on zh to 新表名 fileds dw
*--新表名为结果表

[解决办法]
假设以XH最小的为准:
vfp9:
select a.* into newtt from tt a inner join
(select zh,xm,dw,dwcp,min(xh) as ma from tt group by zh,xm,dw,dwcp) b
on a.zh=b.zh and a.xm=b.xm and a.dw=b.dw and a.dwcp=b.dwcp and a.xh=b.ma

DELETE tt from ;
(select zh,xm,dw,dwcp,min(xh) as ma from tt group by zh,xm,dw,dwcp) as b;
where (tt.zh=b.zh and tt.xm=b.xm and tt.dw=b.dw and tt.dwcp=b.dwcp and tt.xh<>b.ma)

读书人网 >VFP

热点推荐