We help IT Professionals succeed at work.
Get Started

sql script - sql server 2008

230 Views
Last Modified: 2012-05-11
Hi. From the below, how can i calculate the total of col 1 + col2 + col4 and put results in new column named 'newcol5'?

Also, calculate the following: 12 mth average based on recent calendar quarter and put results as 'total12avg'? In this case it would be the average of all rows from column 'month' 2010-04 to 2011-03. Thanks.

Month       col 1      col2 2       col3 x      col4        'newcol 5'
2011-05      x                   x            x               x             x      
2011-04      x      
2011-03      x      
.......-....    x
.......-.....      x             x               x               x             x
2010-04   x             x               x               x             x

First quarter: from the beginning of January to the end of March                        
Second quarter: from the beginning of April to the end of June                        
Third quarter: from the beginning of July to the end of September                        
Fourth quarter: from the beginning of October to the end of December      
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE