Incremental rowwise sum

  • Hello All,

    I am having a table with two columns like monthname and sell. I want to show Jan to dec sell total but in jan only jan , in feb jan + feb, in marc jan+feb+mar and so on.

    How can i do this?

    Thank you
    Abhas.

  • abhas - Tuesday, March 19, 2019 9:25 AM

    Hello All,

    I am having a table with two columns like monthname and sell. I want to show Jan to dec sell total but in jan only jan , in feb jan + feb, in marc jan+feb+mar and so on.

    How can i do this?

    Thank you
    Abhas.

    I suggest that you look for Window Functions or the OVER() clause. That's the simplest way to do it since 2012.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • abhas - Tuesday, March 19, 2019 9:25 AM

    Hello All,

    I am having a table with two columns like monthname and sell. I want to show Jan to dec sell total but in jan only jan , in feb jan + feb, in marc jan+feb+mar and so on.

    How can i do this?

    Thank you
    Abhas.

    Do you have the month name or a number representing the month, e.g. do you have mar or 3? If you store the month name you will need something so it can be sorted in order. The DDL would be helpful.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply