--查询EmsCm表中为空,EmsExgVerEndDate不为空的数据 select a.GNo '平面BO成品序号', a.ExgVersion '平面BOM成品版本', b.ExgNo '帐册成品序号', b.ExgVersion '帐册成品版本' from EmsExgVerEndDate a LEFT JOIN (select distinct ExgNo,ExgVersion from EmsCm) b ON a.GNo=b.ExgNo and a.ExgVersion=b.ExgVersion where b.ExgNo is null
--查询EmsCm表中为空,EmsExgVerEndDate不为空的数据 select a.GNo '平面BO成品序号', a.ExgVersion '平面BOM成品版本', b.ExgNo '帐册成品序号', b.ExgVersion '帐册成品版本' from EmsExgVerEndDate a LEFT JOIN (select distinct ExgNo,ExgVersion from EmsCm) b ON a.GNo=b.ExgNo and a.ExgVersion=b.ExgVersion where b.ExgNo is null and b.ExgVersion is null
--删除EmsExgVerEndDate中的这部分数据delete EmsExgVerEndDate from EmsExgVerEndDate a LEFT JOIN (select distinct ExgNo,ExgVersion from EmsCm) b ON a.GNo=b.ExgNo and a.ExgVersion=b.ExgVersion where b.ExgNo is null and b.ExgVersion is null
delete from EmsExgVerEndDate where GNo+ExgVersion in ( select GNo+ExgVersion from EmsExgVerEndDate where GNo+ExgVersion not in ( select ExgNo+ExgVersion from EmsCm ) )
select a.GNo '平面BO成品序号',
a.ExgVersion '平面BOM成品版本',
b.ExgNo '帐册成品序号',
b.ExgVersion '帐册成品版本'
from EmsExgVerEndDate a
LEFT JOIN (select distinct ExgNo,ExgVersion from EmsCm) b
ON a.GNo=b.ExgNo and a.ExgVersion=b.ExgVersion
where b.ExgNo is null
select a.GNo '平面BO成品序号',
a.ExgVersion '平面BOM成品版本',
b.ExgNo '帐册成品序号',
b.ExgVersion '帐册成品版本'
from EmsExgVerEndDate a
LEFT JOIN (select distinct ExgNo,ExgVersion from EmsCm) b
ON a.GNo=b.ExgNo and a.ExgVersion=b.ExgVersion
where b.ExgNo is null and b.ExgVersion is null
from EmsExgVerEndDate a
LEFT JOIN (select distinct ExgNo,ExgVersion from EmsCm) b
ON a.GNo=b.ExgNo and a.ExgVersion=b.ExgVersion
where b.ExgNo is null and b.ExgVersion is null
from EmsExgVerEndDate
where GNo+ExgVersion in
(
select GNo+ExgVersion
from EmsExgVerEndDate
where GNo+ExgVersion not in
(
select ExgNo+ExgVersion
from EmsCm
)
)