1

Please look at this picture, All the required formula has been mentioned below the columns.

for better clarity my request is...

Column Name "E" : Item open in current month + historical open items (Previous months Sum)

Column Name "F" Warehouse : open items - closed items.

Need of SQL query.. Thanks in advance !

enter image description here

1
  • Feeling Sad No Help ! Commented Apr 19, 2015 at 16:34

1 Answer 1

-1

Take a look at these SQL Server built-in functions.

LAG

LEAD

This post has an example for previous value in SQL Server 2005 and 2012 (this one uses LAG function). How to get previous and current row value using recursive CTE?

Sign up to request clarification or add additional context in comments.

2 Comments

They don't do running totals and aren't available in 2008.
Hi @eternal This is not only about previous value. we have some agg function involved and again its not in 2012. Thank you for you participation.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.