SQLTeam.com | Weblogs | Forums

Getting the Running Inventory using SQL


Hi Dear,

I just want to ask your help on the complex SQL queries. I want to get the running inventory of my tables.


It is difficult to write a query based on a screen shot. If you post consumable data (i.e., something that people can copy and paste to an SSMS window to generate your test data), that would make it easier for someone to respond. You can get some help on how to post from here

From what you have stated, it sounds like a classic problem that has many solutions. Search for "running totals" in SQL and you will find many solutions. If you are on SQL 2012 or later, the solutions are usually easier and more efficient.