sql - Adding up demand and subtracting that from total stock based on demand date -


enter image description here

i need able subtract each days demand supply give me figure based on demand each day, see image

i need able stock level on 06/03/14 7169 (stock) - minus demand date 3157 = 4012

on 18/03/14 need able add togther demand 06/03/14 & 18/03/14 , subtract stock number (7169)- (3157+2632) = 1380 each date adding reqiured figure plus figures , subtracting stock

would best perform in report builder or in sql, below script (where allcompreqd required & binst stock level , wordstat date

select dbo.mbf010.wordno,        dbo.mbf010.partno_wor,        dbo.mbb010.description [wo description],        dbo.mbf020.partno_f02com,        mbb010_1.description   [part description],        dbo.mbf020.allcompreqd,        dbo.mbf010.wordstart,        dbo.mbc010.binst   dbo.mbf010        inner join dbo.mbf020                on dbo.mbf010.account15_wor = dbo.mbf020.account15_f02par                   , dbo.mbf010.wordno = dbo.mbf020.wordno_f02par                   , dbo.mbf010.wordnosuf = dbo.mbf020.wordnosuf_f02par                   , dbo.mbf010.procstage_wor = dbo.mbf020.procstage_f02par        inner join dbo.mbb010                on dbo.mbf010.partno_wor = dbo.mbb010.partno                   , dbo.mbf010.account15_wor = dbo.mbb010.account15        inner join dbo.mbb010 mbb010_1                on dbo.mbf020.account15_f02par = mbb010_1.account15                   , dbo.mbf020.partno_f02com = mbb010_1.partno        inner join dbo.mbc010                on dbo.mbf020.account15_f02par = dbo.mbc010.account15_inv                   , dbo.mbf020.partno_f02com = dbo.mbc010.partno_inv  ( dbo.mbf020.partno_f02com = '04lef009' )        , ( dbo.mbf020.allcompreqd > 0 )  


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -