static void NJ_MF_CleanRepeat(Args _args)
{
    NJ_sInventTable     NJ_sInventTable;                //
    NJ_sSetting         NJ_sSetting,curNJ_sSetting;     //镶口
    NJ_sHead            NJ_sHead,curNj_sHead;           //围头
    NJ_sShank           NJ_sShank,curNJ_sShank;         //比
    NJ_sOthers          NJ_sOthers,curNJ_sOthers;       //其它
/*   NJ_sHead_tmp        tmpNJ_sHead;
    NJ_sOthers_tmp      tmpNJ_sOthers;
    NJ_sShank_tmp       tmpNJ_sShank;
    NJ_sSetting_tmp     tmpNJ_sSetting; */
    TextBuffer          txtBuffer = new TextBuffer();
    int                 i;
    str txtfilePath;
    container                   conFilter = ["Text Files(*.txt)", "*.txt"];

;
/*

insert_recordset tmpNJ_sSetting(RefRecID, NJ_sItemId, NJ_sSetting1StoneWeight, NJ_sSetting1Plug, NJ_sSetting1Size, NJ_sSetting1Size1,
                         NJ_sSetting1ClawQtyId, NJ_sSetting1ClawSharpId, NJ_sSetting1Parts, NJ_sSetting1ShapeId, NJ_sSetting1ClawOneID,
                         NJ_sSetting1StoneQty, NJ_sSetting1StoneQtyWeight, InventSettingId, NJ_sSettingId, NJ_sSetting1ShapeId1,
                         NJ_sSetting1Setting, NJ_sSettingQty)
            select RefRecID, NJ_sItemId, NJ_sSetting1StoneWeight, NJ_sSetting1Plug, NJ_sSetting1Size, NJ_sSetting1Size1,
                         NJ_sSetting1ClawQtyId, NJ_sSetting1ClawSharpId, NJ_sSetting1Parts, NJ_sSetting1ShapeId, NJ_sSetting1ClawOneID,
                         NJ_sSetting1StoneQty, NJ_sSetting1StoneQtyWeight, InventSettingId, NJ_sSettingId, NJ_sSetting1ShapeId1,
                         NJ_sSetting1Setting, NJ_sSettingQty from NJ_sSetting group by
                         RefRecID, NJ_sItemId, NJ_sSetting1StoneWeight, NJ_sSetting1Plug, NJ_sSetting1Size, NJ_sSetting1Size1,
                         NJ_sSetting1ClawQtyId, NJ_sSetting1ClawSharpId, NJ_sSetting1Parts, NJ_sSetting1ShapeId, NJ_sSetting1ClawOneID,
                         NJ_sSetting1StoneQty, NJ_sSetting1StoneQtyWeight, InventSettingId, NJ_sSettingId, NJ_sSetting1ShapeId1,
                         NJ_sSetting1Setting, NJ_sSettingQty;

insert_recordset tmpNJ_sHead(RefRecID, NJ_sItemId, NJ_sHeadShapeId, NJ_sHeadStoneQty, NJ_sHeadStoneQtyWeight, NJ_sHeadSize,
                        NJ_sHeadSize1, NJ_sHeadSettingID, NJ_sHeadStoneWeight, NJ_sHeadIsMainStone, NJ_sHeadId, NJ_sHeadQty, NJ_sHeadShapeId2)
             select RefRecID, NJ_sItemId, NJ_sHeadShapeId, NJ_sHeadStoneQty, NJ_sHeadStoneQtyWeight, NJ_sHeadSize,
                        NJ_sHeadSize1, NJ_sHeadSettingID, NJ_sHeadStoneWeight, NJ_sHeadIsMainStone, NJ_sHeadId, NJ_sHeadQty, NJ_sHeadShapeId2
                        from NJ_sHead group by RefRecID, NJ_sItemId, NJ_sHeadShapeId, NJ_sHeadStoneQty, NJ_sHeadStoneQtyWeight, NJ_sHeadSize,
                        NJ_sHeadSize1, NJ_sHeadSettingID, NJ_sHeadStoneWeight, NJ_sHeadIsMainStone, NJ_sHeadId, NJ_sHeadQty, NJ_sHeadShapeId2;

insert_recordset tmpNJ_sOthers(RefRecID, NJ_sItemId, NJ_sOthersShapeId, NJ_sOthersStoneQty, NJ_sOthersStoneQtyWeight, NJ_sOthersSize,
                        NJ_sOthersSize1, NJ_sOthersSettingID, NJ_sOthersStoneWeight)
             select RefRecID, NJ_sItemId, NJ_sOthersShapeId, NJ_sOthersStoneQty, NJ_sOthersStoneQtyWeight, NJ_sOthersSize,
                        NJ_sOthersSize1, NJ_sOthersSettingID, NJ_sOthersStoneWeight
                        from NJ_sOthers group by RefRecID, NJ_sItemId, NJ_sOthersShapeId,NJ_sOthersStoneQty, NJ_sOthersStoneQtyWeight, NJ_sOthersSize,
                        NJ_sOthersSize1, NJ_sOthersSettingID, NJ_sOthersStoneWeight;

insert_recordset tmpNJ_sShank(RefRecID, NJ_sItemId, NJ_sShankShapeId, NJ_sShankStoneQty, NJ_sShankStoneQtyWeight, NJ_sShankSize, NJ_sShankSize1,
                        NJ_sShankSettingID, NJ_sShankStoneWeight)
             select RefRecID, NJ_sItemId, NJ_sShankShapeId, NJ_sShankStoneQty, NJ_sShankStoneQtyWeight, NJ_sShankSize, NJ_sShankSize1,
                        NJ_sShankSettingID, NJ_sShankStoneWeight from NJ_sShank group by RefRecID, NJ_sItemId, NJ_sShankShapeId, NJ_sShankStoneQty,
                        NJ_sShankStoneQtyWeight, NJ_sShankSize, NJ_sShankSize1, NJ_sShankSettingID, NJ_sShankStoneWeight;

*/

//print (select nj_sItemId,count(recid) from nj_sHead group by nj_sItemId).nj_sItemId;

while select count(recid),RefRecID, NJ_sItemId, NJ_sHeadShapeId, NJ_sHeadStoneQty, NJ_sHeadStoneQtyWeight, NJ_sHeadSize,
                        NJ_sHeadSize1, NJ_sHeadSettingID, NJ_sHeadStoneWeight, NJ_sHeadIsMainStone, NJ_sHeadId, NJ_sHeadQty, NJ_sHeadShapeId2
                        from nj_sHead
                        group by RefRecID, NJ_sItemId, NJ_sHeadShapeId, NJ_sHeadStoneQty, NJ_sHeadStoneQtyWeight, NJ_sHeadSize,
                        NJ_sHeadSize1, NJ_sHeadSettingID, NJ_sHeadStoneWeight, NJ_sHeadIsMainStone, NJ_sHeadId, NJ_sHeadQty, NJ_sHeadShapeId2
                        {

if(nj_sHead.RecId>1)
                            {
                            i = 1;
                            while select curNj_sHead where curNj_sHead.NJ_sItemId == nj_sHead.NJ_sItemId
                                                    && curNj_sHead.RefRecID == nj_sHead.RefRecID
                                                    && curNj_sHead.NJ_sHeadShapeId == nj_sHead.NJ_sHeadShapeId
                                                    && curNj_sHead.NJ_sHeadStoneQty == nj_sHead.NJ_sHeadStoneQty
                                                    && curNj_sHead.NJ_sHeadStoneQtyWeight == nj_sHead.NJ_sHeadStoneQtyWeight
                                                    && curNj_sHead.NJ_sHeadSize == nj_sHead.NJ_sHeadSize
                                                    && curNj_sHead.NJ_sHeadSize1 == nj_sHead.NJ_sHeadSize1
                                                    && curNj_sHead.NJ_sHeadSettingID == nj_sHead.NJ_sHeadSettingID
                                                    && curNj_sHead.NJ_sHeadStoneWeight ==nj_sHead.NJ_sHeadStoneWeight
                                                    && curNj_sHead.NJ_sHeadIsMainStone == nj_sHead.NJ_sHeadIsMainStone
                                                    && curNj_sHead.NJ_sHeadId == nj_sHead.NJ_sHeadId
                                                    && curNj_sHead.NJ_sHeadQty == nj_sHead.NJ_sHeadQty
                                                    && curNj_sHead.NJ_sHeadShapeId2 == nj_sHead.NJ_sHeadShapeId2
                                                    {
                                                        if(i <= nj_sHead.RecId - 1)
                                                        {
                                                            //curNj_sHead.doDelete();
                                                            print strfmt("围头,%1 , %2 , %3" ,curNj_sHead.NJ_sItemId,curNj_sHead.RecId,nj_sHead.RecId);
                                                            txtBuffer.appendText(strfmt("围头,%1 , %2 , %3 \n"  ,curNj_sHead.NJ_sItemId,curNj_sHead.RecId,nj_sHead.RecId));
                                                            i++;
                                                        }
                                                    }

}
                        }
while select count(recid),RefRecID, NJ_sItemId, NJ_sSetting1StoneWeight, NJ_sSetting1Plug, NJ_sSetting1Size, NJ_sSetting1Size1,
                         NJ_sSetting1ClawQtyId, NJ_sSetting1ClawSharpId, NJ_sSetting1Parts, NJ_sSetting1ShapeId, NJ_sSetting1ClawOneID,
                         NJ_sSetting1StoneQty, NJ_sSetting1StoneQtyWeight, InventSettingId, NJ_sSettingId, NJ_sSetting1ShapeId1,
                         NJ_sSetting1Setting, NJ_sSettingQty
                         from NJ_sSetting
                         group by RefRecID, NJ_sItemId, NJ_sSetting1StoneWeight, NJ_sSetting1Plug, NJ_sSetting1Size, NJ_sSetting1Size1,
                         NJ_sSetting1ClawQtyId, NJ_sSetting1ClawSharpId, NJ_sSetting1Parts, NJ_sSetting1ShapeId, NJ_sSetting1ClawOneID,
                         NJ_sSetting1StoneQty, NJ_sSetting1StoneQtyWeight, InventSettingId, NJ_sSettingId, NJ_sSetting1ShapeId1,
                         NJ_sSetting1Setting, NJ_sSettingQty
                         {
                            if(NJ_sSetting.RecId > 1)
                            {
                             i = 1;
                             while select curNJ_sSetting where curNJ_sSetting.RefRecID == nj_sSetting.RefRecID
                                                            && curNJ_sSetting.NJ_sItemId == nj_sSetting.NJ_sItemId
                                                            && curNJ_sSetting.NJ_sSetting1StoneWeight == nj_sSetting.NJ_sSetting1StoneWeight
                                                            && curNJ_sSetting.NJ_sSetting1Plug == nj_sSetting.NJ_sSetting1Plug
                                                            && curNJ_sSetting.NJ_sSetting1Size == nj_sSetting.NJ_sSetting1Size
                                                            && curNJ_sSetting.NJ_sSetting1Size1 == nj_sSetting.NJ_sSetting1Size1
                                                            && curNJ_sSetting.NJ_sSetting1ClawQtyId == nj_sSetting.NJ_sSetting1ClawQtyId
                                                            && curNJ_sSetting.NJ_sSetting1ClawSharpId == nj_sSetting.NJ_sSetting1ClawSharpId
                                                            && curNJ_sSetting.NJ_sSetting1Parts == nj_sSetting.NJ_sSetting1Parts
                                                            && curNJ_sSetting.NJ_sSetting1ShapeId == nj_sSetting.NJ_sSetting1ShapeId
                                                            && curNJ_sSetting.NJ_sSetting1ClawOneID == nj_sSetting.NJ_sSetting1ClawOneID
                                                            && curNJ_sSetting.NJ_sSetting1StoneQty == nj_sSetting.NJ_sSetting1StoneQty
                                                            && curNJ_sSetting.NJ_sSetting1StoneQtyWeight == nj_sSetting.NJ_sSetting1StoneQtyWeight
                                                            && curNJ_sSetting.InventSettingId == curNJ_sSetting.InventSettingId
                                                            && curNJ_sSetting.NJ_sSettingId == curNJ_sSetting.NJ_sSettingId
                                                            && curNJ_sSetting.NJ_sSetting1ShapeId1 == curNJ_sSetting.NJ_sSetting1ShapeId1
                                                            && curNJ_sSetting.NJ_sSetting1Setting == curNJ_sSetting.NJ_sSetting1Setting
                                                            && curNJ_sSetting.NJ_sSettingQty == curNJ_sSetting.NJ_sSettingQty
                                                            {
                                                                if(i <= NJ_sSetting.RecId - 1)
                                                                {
                                                                //curNJ_sSetting.doDelete();
                                                                print strfmt("镶口, %1 , %2 , %3" ,curNJ_sSetting.NJ_sItemId,curNJ_sSetting.RecId,NJ_sSetting.RecId);
                                                                txtBuffer.appendText(strfmt("镶口, %1 , %2 , %3 \n" ,curNJ_sSetting.NJ_sItemId,curNJ_sSetting.RecId,NJ_sSetting.RecId));
                                                                i++;
                                                                }

}
                            }

}

while select count(recid),RefRecID, NJ_sItemId, NJ_sOthersShapeId, NJ_sOthersStoneQty, NJ_sOthersStoneQtyWeight, NJ_sOthersSize,
                        NJ_sOthersSize1, NJ_sOthersSettingID, NJ_sOthersStoneWeight
                        from NJ_sOthers
                        group by RefRecID, NJ_sItemId, NJ_sOthersShapeId, NJ_sOthersStoneQty, NJ_sOthersStoneQtyWeight, NJ_sOthersSize,
                        NJ_sOthersSize1, NJ_sOthersSettingID, NJ_sOthersStoneWeight
                        {
                         if(NJ_sOthers.recid > 1)
                         {
                          i = 1;
                          while select curNJ_sOthers where curNJ_sOthers.RefRecID == NJ_sOthers.RefRecID
                                                    && curNJ_sOthers.NJ_sItemId == NJ_sOthers.NJ_sItemId
                                                    && curNJ_sOthers.NJ_sOthersShapeId == NJ_sOthers.NJ_sOthersShapeId
                                                    && curNJ_sOthers.NJ_sOthersStoneQty == NJ_sOthers.NJ_sOthersStoneQty
                                                    && curNJ_sOthers.NJ_sOthersStoneQtyWeight == NJ_sOthers.NJ_sOthersStoneQtyWeight
                                                    && curNJ_sOthers.NJ_sOthersSize == NJ_sOthers.NJ_sOthersSize
                                                    && curNJ_sOthers.NJ_sOthersSize1 == NJ_sOthers.NJ_sOthersSize1
                                                    && curNJ_sOthers.NJ_sOthersSettingID == NJ_sOthers.NJ_sOthersSettingID
                                                    && curNJ_sOthers.NJ_sOthersStoneWeight == NJ_sOthers.NJ_sOthersStoneWeight
                                                    {
                                                        if (i <= NJ_sOthers.RecId - 1)
                                                        {
                                                            //curNJ_sOthers.doDelete();
                                                            print strfmt("其它,%1  %2  %3" ,curNJ_sOthers.NJ_sItemId,curNJ_sOthers.RecId,NJ_sOthers.RecId);
                                                            txtBuffer.appendText(strfmt("其它,%1  %2  %3 \n" ,curNJ_sOthers.NJ_sItemId,curNJ_sOthers.RecId,NJ_sOthers.RecId));
                                                            i++;
                                                        }
                                                    }
                         }

}

while select count(RecId),RefRecID, NJ_sItemId, NJ_sShankShapeId, NJ_sShankStoneQty, NJ_sShankStoneQtyWeight, NJ_sShankSize, NJ_sShankSize1,
                        NJ_sShankSettingID, NJ_sShankStoneWeight
                        from NJ_sShank group by RefRecID, NJ_sItemId, NJ_sShankShapeId, NJ_sShankStoneQty, NJ_sShankStoneQtyWeight, NJ_sShankSize, NJ_sShankSize1,
                        NJ_sShankSettingID, NJ_sShankStoneWeight
                        {
                            if(NJ_sShank.RecId >1)
                            {
                             i=1;
                             while select curNJ_sShank where curNJ_sShank.RefRecID == NJ_sShank.RefRecID
                                                        && curNJ_sShank.NJ_sItemId == NJ_sShank.NJ_sItemId
                                                        && curNJ_sShank.NJ_sShankShapeId == NJ_sShank.NJ_sShankShapeId
                                                        && curNJ_sShank.NJ_sShankStoneQty == NJ_sShank.NJ_sShankStoneQty
                                                        && curNJ_sShank.NJ_sShankStoneQtyWeight == NJ_sShank.NJ_sShankStoneQtyWeight
                                                        && curNJ_sShank.NJ_sShankSize == NJ_sShank.NJ_sShankSize
                                                        && curNJ_sShank.NJ_sShankSize1 == NJ_sShank.NJ_sShankSize1
                                                        && curNJ_sShank.NJ_sShankSettingID == NJ_sShank.NJ_sShankSettingID
                                                        && curNJ_sShank.NJ_sShankStoneWeight == NJ_sShank.NJ_sShankStoneWeight
                                                        {
                                                            if(i <= NJ_sShank.RecId - 1)
                                                            {
                                                                //curNJ_sShank.doDelete();
                                                                print strfmt("比, %1 , %2 , %3 " ,curNJ_sShank.NJ_sItemId,curNJ_sShank.RecId,NJ_sShank.RecId);
                                                                txtBuffer.appendText(strfmt("比, %1 , %2 , %3 \n" ,curNJ_sShank.NJ_sItemId,curNJ_sShank.RecId,NJ_sShank.RecId));
                                                                i++;
                                                            }
                                                        }
                            }

}

txtfilePath = Winapi::getSaveFileName(0, conFilter,"", "Specify SaveFile Name", "", "");
    if(txtfilePath)
    {
        txtBuffer.toFile(txtfilePath);
    }
pause;

}

转载于:https://www.cnblogs.com/perock/archive/2011/12/22/2297213.html

清除重复记录只保留一条相关推荐

  1. mysql删除重复记录只保留一条

    2019独角兽企业重金招聘Python工程师标准>>> 删除表中重复记录,只保留一条: delete from 表名 where 字段ID in (select * from (se ...

  2. SQL删除表中的重复记录只保留其中一条,最简单的方法:ROW_NUMBER()

    在几千条记录里,存在着些相同的记录,如何能用SQL语句,删除掉重复的呢?. 要求:删除表中多余的重复记录,且保留 id 最小的那一条记录. CREATE TABLE #temp_data( id BI ...

  3. 【数据库】Mysql删除重复记录只保留一条

    实际工作中,有可能会对数据库中的数据进行再次加工.假设有个表记录的是技术文章,有三个字段:st_link(文章链接).st_title(文章章节标题).st_name(文章名称) 假设初始时主键为st ...

  4. mysql 删除重复数据只保留一条记录

    删除重复数据保留name中id最小的记录 delete from order_info where id not in (select id from (select min(id) as id fr ...

  5. SQL删除重复的记录(只保留一条)

    首先新建表: --创建示例表 CREATE TABLE t (id INT IDENTITY(1,1) PRIMARY KEY,a VARCHAR(10),b VARCHAR(10) ) --插入数据 ...

  6. MySQL 中删除重复数据只保留一条

    WechatIMG256.jpeg 场景 在许多条记录里,存在着些相同的记录,使用SQL语句,删除掉重复项只保留一条. 数据模型 half_demon 半妖表 id name weapon skill ...

  7. MySQL中删除重复数据只保留一条

    用SQL语句,删除掉重复项只保留一条 在几千条记录里,存在着些相同的记录,如何能用SQL语句,删除掉重复的呢 1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 SELECT ...

  8. MySQL批量删除所有重复数据只保留一条

    -- 1.创建数据库及t_user表 CREATE DATABASE IF NOT EXISTS `test` DEFAULT CHARACTER SET utf8;USE `test`;DROP T ...

  9. mysql去除重复数据保留一条_MySQL中删除重复数据只保留一条

    用SQL语句,删除掉重复项只保留一条 在几千条记录里,存在着些相同的记录,如何能用SQL语句,删除掉重复的呢 1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断 SELECT ...

最新文章

  1. 机器学习中的L1与L2正则化图解!
  2. Linux之 xstart调用 x11vnc远程图形化桌面
  3. COM:根系-土壤-微生物互作
  4. 使用sui实现的选择控件【性别、日期、省市级联】
  5. python32位安装
  6. Linux命令行之逗趣无极限
  7. php 内置mail 包,配置php自带的mail功能
  8. 无线连接 服务器,服务器无线远程连接
  9. CentOS系统Kernel panic - not syncing: Attempted to k
  10. CSS3的radial-gradient(径向渐变)
  11. 基于人人网的简单爬虫(二)——具体实现
  12. pip国内镜像源矩池云收集(2020年8月)
  13. typescript 怎么表示当前时间减一个月_吃什么减肚子最快最有效 4种刮油食物吃出小蛮腰...
  14. P4782 【模板】2-SAT 问题
  15. 全新UI多用户任务悬赏系统源码+带三级分销推广
  16. 小呆聚合支付系统是个人二维码免签约即时到账多商户支付系统v1.7文字教程
  17. QWebEngineView播放视频最大化
  18. python迷宫小游戏代码_python迷宫游戏,迷宫生成,解决与可视化
  19. scala连接mysql数据库
  20. [微信小程序]手机系统默认字体的设置

热门文章

  1. Java算法--冒泡排序
  2. vuecli启动的服务器位置,VUE启动流程vue-cli
  3. python文件中环境声明_Python环境构建
  4. 8080端口被占用_Spring Cloud IPv6端口问题排坑
  5. autofac 作用域_控制作用域和生命周期
  6. Java转gcode,学用树莓派(8)-实战案例:基于树莓派JAVA的微型激光雕刻机
  7. 手机蓝牙如何减少延时_如何使用车载蓝牙播放手机音乐的方法
  8. 数据类型(整型、浮点数、字符串、时间和日期)、切分(水平、垂直)
  9. ubuntu系统中samba服务器搭建
  10. C++ public、protected、private区别