How to write the sql query calculating the closing stock .
Closing Stock : Opening Stock - other (order_type_desc)
group by period_key
See Screenshots :
In the above example :
Closing Stock will be : 3375 - (-3498+29821)
There can be other order_type_desc as well . See another example screenshot :
In this example
Closing Stock : Opening Balance - Sales
How to write a view in SQL SERVER 2005
Thanks,