规格查找

--库存拉链类规格与规格档案的规格不相同的记录.CSV
select md.mdmodel from model ,
( select f.code as code,s.model as mdmodel from stock s ,mmf f , model m where s.matid=f.matid and substring(f.code,1,1)='Q'
and s.qty>=1 and s.mpsid=''
union
select f.code as code,s.model as mdmodel from stock s ,mmf f , model m where s.matid=f.matid and substring(f.code,1,1)='Q'
and s.qty>=1 and s.mpsid='' ) as md
where model.name!=md.mdmodel
union
select md.mdmodel from model ,
( select f.code as code,s.model as mdmodel from stock s ,mmf f , model m where s.matid=f.matid and substring(f.code,1,1)='Q'
and s.qty>=1 and s.mpsid=''
union
select f.code as code,s.model as mdmodel from stock s ,mmf f , model m where s.matid=f.matid and substring(f.code,1,1)='Q'
and s.qty>=1 and s.mpsid='' ) as md
where model.name!=md.mdmodel

按仓库的需求。 

posted @ 2008-04-21 21:40  爱生活,爱编程  阅读(160)  评论(0编辑  收藏  举报