愿得一人心,白首不相离。
UOC

统计库存量

select
v_ex_currentstockquery.cWhCODE as '仓别',
v_ex_currentstockquery.cWhName as '仓库',
b.cInvCode as '物料编码',
inventory.cinvname as '存货名称',
v_ex_currentstockquery.cInvStd as '规格型号',
isnull(v_ex_currentstockquery.iQuantity,0) as '数量',
b.iNatUnitPrice as '最新价格 ',
isnull(v_ex_currentstockquery.iQuantity,0)*b.iNatUnitPrice as '合计'
 from  v_ex_currentstockquery
 left join (
 select iNatUnitPrice,PO_Podetails.cInvCode from PO_Podetails,
(select MAX(id) as id ,cInvCode from PO_Podetails
group by cInvCode)a
  where PO_Podetails.ID=a.id and
 PO_Podetails.cInvCode=a.cinvcode)
 b
 on b.cInvCode= v_ex_currentstockquery.cinvcode
  left join inventory on inventory.cinvcode=b.cinvcode
  where  v_ex_currentstockquery.cWhCode in
  ('100','101','102','103','104','105','106','107','108','120','121','122','123','124',

Jack 2018-1-7 0评论