September 28, 2010 at 12:49 pm
Hello Experts,
I have a db table named InventoryLookup. I store inventory transaction summaries in this table.
CREATE TABLE [dbo].[InventoryFact](
[StyleCode] [varchar](23) NULL,
[WarehouseID] [char](4) NULL,
[DateID] [smalldatetime] NULL,
[Quantity] [int] NULL
) ON [PRIMARY]
GO
INSERT INTO InventoryFact VALUES ('RW900505002493','1001','18/09/2009',23)
INSERT INTO InventoryFact VALUES ('RW900505002493','1001','19/09/2009',-1)
INSERT INTO InventoryFact VALUES ('RW900505002493','1001','22/09/2009',-1)
INSERT INTO InventoryFact VALUES ('RW900505002493','1001','29/09/2009',-1)
How can I apply a running total method to this table?
I mean my desired resultset should be like below:
'RW900505002493' 1001 18/09/2009 23
'RW900505002493' 1001 19/09/2009 22
'RW900505002493' 1001 22/09/2009 21
'RW900505002493' 1001 29/09/2009 20
Regards
September 28, 2010 at 12:52 pm
Please read this article[/url] - just be sure to follow all the rules in using this form of the update statement - they must be followed or you can get erroneous results!
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 28, 2010 at 1:08 pm
Thank you very much for your great comment.
Is it really such a complex query issue to get running totals of a table?
Regards
September 28, 2010 at 2:19 pm
erdem1973 (9/28/2010)
Thank you very much for your great comment.Is it really such a complex query issue to get running totals of a table?
Regards
You're welcome.
Until Microsoft decides to fully implement the window functions, yes it is this complex.
You might want to visit this editorial
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply