select INVENTSUM.itemid, sum(postedqty) as Postedqty,
sum(Received) as Received,
sum(Deducted) as Deducted,
sum(Registered) as Registered,
sum(PICKED) as PICKED,
sum(RESERVPHYSICAL) as RESERVPHYSICAL,
sum(ORDERED) as ORDERED,
sum(ARRIVED) as ARRIVED,
sum(RESERVORDERED) as RESERVORDERED,
sum(ONORDER) as ONORDER,
INVENTDIM.INVENTLOCATIONID,
INVENTDIM.INVENTSITEID,
INVENTDIM.CONFIGID
from INVENTSUM
join INVENTDIM
on INVENTDIM.INVENTDIMID = INVENTSUM.INVENTDIMID
where LASTUPDDATEPHYSICAL <= '2016-04-01'
--and itemid = '200935'
group by INVENTSUM.itemid, INVENTDIM.INVENTLOCATIONID,INVENTDIM.INVENTSITEID,INVENTDIM.CONFIGID
--------------------------------------------------------------------------------------------------------
select * from (select INVENTSUM.itemid, sum(AvailPhysical) as AvailPhysical,
INVENTDIM.INVENTLOCATIONID,
INVENTDIM.INVENTSITEID,
INVENTDIM.CONFIGID,
INVENTDIM.INVENTSTYLEID,INVENTDIM.INVENTCOLORID
,INVENTDIM.INVENTBATCHID,INVENTDIM.INVENTSIZEID
from INVENTSUM as INVENTSUM
join INVENTDIM
on INVENTDIM.INVENTDIMID = INVENTSUM.INVENTDIMID
where /*LASTUPDDATEPHYSICAL <= '2016-04-01'
and */ INVENTSUM.itemid = 'A92991Y61553' and INVENTSUM.DATAAREAID = 'USMF'
and INVENTDIM.INVENTSTYLEID != ''
group by INVENTSUM.itemid, INVENTDIM.INVENTLOCATIONID,INVENTDIM.INVENTSITEID,INVENTDIM.CONFIGID,INVENTDIM.INVENTSTYLEID,INVENTDIM.INVENTCOLORID,INVENTDIM.INVENTBATCHID,INVENTDIM.INVENTSIZEID)
Stock
where stock.AvailPhysical >0
sum(Received) as Received,
sum(Deducted) as Deducted,
sum(Registered) as Registered,
sum(PICKED) as PICKED,
sum(RESERVPHYSICAL) as RESERVPHYSICAL,
sum(ORDERED) as ORDERED,
sum(ARRIVED) as ARRIVED,
sum(RESERVORDERED) as RESERVORDERED,
sum(ONORDER) as ONORDER,
INVENTDIM.INVENTLOCATIONID,
INVENTDIM.INVENTSITEID,
INVENTDIM.CONFIGID
from INVENTSUM
join INVENTDIM
on INVENTDIM.INVENTDIMID = INVENTSUM.INVENTDIMID
where LASTUPDDATEPHYSICAL <= '2016-04-01'
--and itemid = '200935'
group by INVENTSUM.itemid, INVENTDIM.INVENTLOCATIONID,INVENTDIM.INVENTSITEID,INVENTDIM.CONFIGID
--------------------------------------------------------------------------------------------------------
select * from (select INVENTSUM.itemid, sum(AvailPhysical) as AvailPhysical,
INVENTDIM.INVENTLOCATIONID,
INVENTDIM.INVENTSITEID,
INVENTDIM.CONFIGID,
INVENTDIM.INVENTSTYLEID,INVENTDIM.INVENTCOLORID
,INVENTDIM.INVENTBATCHID,INVENTDIM.INVENTSIZEID
from INVENTSUM as INVENTSUM
join INVENTDIM
on INVENTDIM.INVENTDIMID = INVENTSUM.INVENTDIMID
where /*LASTUPDDATEPHYSICAL <= '2016-04-01'
and */ INVENTSUM.itemid = 'A92991Y61553' and INVENTSUM.DATAAREAID = 'USMF'
and INVENTDIM.INVENTSTYLEID != ''
group by INVENTSUM.itemid, INVENTDIM.INVENTLOCATIONID,INVENTDIM.INVENTSITEID,INVENTDIM.CONFIGID,INVENTDIM.INVENTSTYLEID,INVENTDIM.INVENTCOLORID,INVENTDIM.INVENTBATCHID,INVENTDIM.INVENTSIZEID)
Stock
where stock.AvailPhysical >0