欢迎访问 生活随笔!

尊龙游戏旗舰厅官网

当前位置: 尊龙游戏旗舰厅官网 > 编程资源 > 编程问答 >内容正文

编程问答

清除重复记录只保留一条 -尊龙游戏旗舰厅官网

发布时间:2024/10/8 编程问答 0 豆豆
尊龙游戏旗舰厅官网 收集整理的这篇文章主要介绍了 清除重复记录只保留一条 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

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

总结

以上是尊龙游戏旗舰厅官网为你收集整理的清除重复记录只保留一条的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得尊龙游戏旗舰厅官网网站内容还不错,欢迎将尊龙游戏旗舰厅官网推荐给好友。

网站地图