I have the following piece of code SELECTinFromInventory.InvUnitResource AS Resource,inFromInventory.InvUnitSite AS Production_Site,ROUND(SUM(inFromInventory.PrimQty),5) AS UsageRND ,inFromInventory.UpdateDateFROMinFromInventory (NOLOCK)INNER JOIN fdBasResc (NOLOCK) ON fdBasResc.ObjectID = inFromInventory.InvUnitRescOIDWHERE/* Sunday of 16 Weeks ago*/inFromInventory.UpdateDate >= (cast(left(cast(getdate()-datepart(dw,getdate()) as varchar(35)),11) + ' '+cast('00:00:00' as varchar(8)) as datetime)) -111AND inFromInventory.ActyDrvrActyTyp IN (3,16,17) /*Schedule Consumption, Inventory Adjustments, Cycle Counts*/AND inFromInventory.InvUnitSite IN ('S01','S02','S05','S06','S10','S11','S14','S15') /*Production Sites*/AND inFromInventory.InvUnitArea IN ('RW1','CK1','ER1','PY1','PN1','RTC','SA1','CSM') /*Production Areas*/AND fdBasResc.CatCodesCode1 = 'MEAT'GROUP BYinFromInventory.InvUnitResource,inFromInventory.InvUnitSite,inFromInventory.UpdateDate
the inFromInventory.UpdateDate field contains a date value range of the last 16weeks (will always be the last 16 weeks). What would be the best way for me to further define this field by week ranging from Sun-Sat? My aim is to get a total weekly spend.