zoukankan      html  css  js  c++  java
  • 查找XTWL_TB中的重复条数


    (1)规格型号不为空:
    select *
    from sm_zdb_xtwl_TB t
    where exists(
    select 1
    from sm_zdb_xtwl_TB
    where ID != t.ID and WLMC=t.WLMC and GGXH=t.GGXH)

    (2)规格型号为空:
    select t.id
    from sm_zdb_xtwl_TB t
    where exists(
    select 1
    from sm_zdb_xtwl_TB
    where ID != t.ID and WLMC=t.WLMC ) and GGXH is null

    1、从CPWL中找出重复条数所对应的记录:
    (1)规格型号不为空:
    select t1.*, t1.rowid from sm_zdb_cpwl_tb t1 where t1.xtwlid in (select t.id from sm_zdb_xtwl_TB t where exists( select 1 from sm_zdb_xtwl_TB where ID != t.ID and WLMC=t.WLMC and GGXH=t.GGXH))

    (2)规格型号为空:
    select t1.*, t1.rowid from sm_zdb_cpwl_tb t1 where t1.xtwlid in (select t.id
    from sm_zdb_xtwl_TB t
    where exists(
    select 1
    from sm_zdb_xtwl_TB
    where ID != t.ID and WLMC=t.WLMC ) and GGXH is null
    )

    2、在XTWL中加入LSBH,将重复的记录中的流水编号设为需要的xtwlid:

    手动更新


    3、先找出XTWL中的重复记录:

    select t.id,t.lsbh from sm_zdb_xtwl_TB t where t.lsbh is not null

    4、查找CPWL表中的重复记录:

    select t.*, t.rowid from sm_zdb_cpwl_tb t where t.xtwlid in(select t1.id from sm_zdb_xtwl_TB t1 where t1.lsbh is not null)

    5、更新CPWL表中的重复记录:

    update sm_zdb_cpwl_tb t set t.xtwlid=(select t2.lsbh from sm_zdb_xtwl_TB t2 where t2.id=t.xtwlid ) where t.xtwlid in (select t1.id from sm_zdb_xtwl_TB t1 where t1.lsbh is not null)

    6、针对CPWL表中的TZID与XTWLID对应关系重复的记录删减;


    问题:
    1、BOM变更配比关系可以修改?相应的订单数量和生产数量也可以修改。。。
    2、时间区间查询。。。

  • 相关阅读:
    js中常见事件
    第六周
    石家庄地铁售票系统
    第五周
    第四周
    html总结2
    返回一个整数数组中最大子数组的和(续)
    第九周总结
    团队冲刺第五天-KeepRunningAPP
    团队冲刺第四天-KeepRunningAPP
  • 原文地址:https://www.cnblogs.com/nuaaydh/p/4341785.html
Copyright © 2011-2022 走看看