I need urgent help with reference to SQL server, the query details is as mentioned below:
Need to get the calculative column whose result will be addition of all the above rows. And I can't use correlated queries, Lag and Lead as it is not supported. I tried using Selfjoin/inner join/left outer join, the only problem I am facing is due to group by clause of other columns the result is not coming as expected..
Data is like
But the output I am getting due to group by clause applied on Column4 Output getting is like
Column1 Column2 Column3 Column5(Summation of Column3)
1 20140221 0 0
1 20140222 10 10
1 20140225 20 30(20+10)
1 20140228 30 60(30+30)(As Column4 is having value B for this date so due to group by clause it doesn't add the data from previous row.)
Please let me know some alternative of GROUP by clause or other alternative. Your quick help will be much appreciated.
Nov 13, 2017 at 04:40 PM