日期:2014-05-18 浏览次数:20452 次
insert into dffwz(年份,月份,bmid) select distinct 年份,月份,left(bmid,6) bmid from dfgzlr AS T where Len(bmid)=6 AND 月份 NOT IN (SELECT 月份 FROM dffwz WHERE T.年份 = 年份)
------解决方案--------------------
insert into dffwz(年份,月份,bmid)
select distinct 年份,月份,left(bmid,6) bmid from dfgzlr
where Len(bmid)=6 and not exists( select * from dffwz t1 where dfgzlr.月份=t1.月份)