Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2012-11-06 : 03:51:51
|
Hi All,I have a table which i need to find out the Opening balance and closing balance for the sales team for the last 1 week. -- Get what Rep has been SHIPPED SELECT mo.Material_ID, ss.BatchNumber,SUM(ss.Quantity) as [Shipped], ExpiryDate FROM Material_Order_Sample_Shipment ss JOIN Material_Order mo ON mo.ID = ss.Material_Order_ID WHERE mo.Rep_ID = @Rep_ID AND ss.Material_Order_ID IN (SELECT ID FROM Material_Order WHERE Status_ID = 2 AND datereceived >=dateadd(dd,-7,getdate())) GROUP BY ss.BatchNumber, mo.Material_ID, ExpiryDate ORDER BY mo.Material_ID Please help me to get the query to get the transaction for 1 week.Or any suggestion welcome.Regards,GangadharaThanks,Gangadhara MSSQL Developer and DBA |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-11-06 : 12:33:10
|
Your question is vague. Without knowing data in your table and concept of trsnsaction for you nobody will be able to provide you with accurate solutionPost some sample data as per below and somebody will be able to helphttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|