Calculation as Tsql query RRS feed

  • Question

  • Hi, I have table with five columns and some calculation needs to be done from that table. I can do in Excell, but failed as Tsql query beacuse the values changes dynamically. Below is table with columns(Previous Grade,A grade,B grade,C grade,Total) Previous Grade A grade B grade C grade Total A grade 11 22 33 66 B grade 44 55 66 165 C grade 77 88 99 264 Three calculation are required to be done: For grade improves: if it goes from B grade to A garde or From C grade to A,B grade. That is : (44+77+88)/(66+165+264) For grade stay same: If it stays same as of Previous Grade That is : (11+55+99)/(66+165+264) For Grade gets worse: If it goes from Grade A to Grade b,c or From Grade B to Grade C. That is : (22_33+66)/(66+165+264) Is there is any way to write a Tsql code to get this calculation. Please suggest. Any help is apprecaited. Thanks, Punia
    Wednesday, December 7, 2011 2:24 PM


All replies