Forum Discussion

namemon's avatar
namemon
Frequent Visitor
2 years ago
Solved

Is it possible to increment an Column in MS SQL inside a WITH and CASE WHEN statement.

Is it possible to increment an Column : Stock_product in MS SQL inside a WITH and CASE WHEN statement. I am attempting to sum amount products per day (Column : sum_Per_Day) in my table to get Column...
  • Musadev's avatar
    2 years ago

    Hi namemon 

     

    You need to get the running sum for each order and the order should be on the date, right?

    Try to use Windows function and partition the data based on the order and date, the date should be in ascending order. 

    Please share sample data as mentioned in the screenshot, I will give a shot to it. Thanks