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、时间区间查询。。。

  • 相关阅读:
    usually study notebook
    (转)轻松掌握shell编程中数组的常见用法及示例
    (转)python学习链接
    (转)Python作业day2购物车
    (转)python 列表与元组的操作简介
    (转)总结Linux的chattr与lsattr命令详解
    mysql特殊语句学习
    PHP位操作符
    html5中script的async属性
    jquery资源
  • 原文地址:https://www.cnblogs.com/nuaaydh/p/4341785.html
Copyright © 2011-2022 走看看