日期:2014-05-18 浏览次数:20451 次
with t as( select a.*,b.updatetime from 采购明细 a inner join 采购表 b on a.orderID=b.orderID ) select * from 物品表 a where not exists( select 1 from t where a.PRODUCTID=b.PRODUCTID and datepart(b.updatetime )=5 ) --try
------解决方案--------------------
select * from 物品表 a where not eixsts(select 1 from 采购表 m,采购明细表n where m.orderID=n.orderID and a.PRODUCTID=n.PRODUCTID and month(m.updatetime)=5)
------解决方案--------------------
select * from 物品表 where 物品编号 not in ( select 物品编号 from 采购明细表 where 采购日期 between 2012-5-1 and 2012-5-31)