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

posted @ 2015-03-16 14:34  大虎1  阅读(211)  评论(0编辑  收藏  举报