[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

02/15/2006 at 03:49PM PST, ID: 21738614
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Calculating the Percentage of the Row Total to the Grand Total

Asked by CharlesHWhite in MS SQL Server

Tags: calculate, sql

I want the sum of the Total column and will call it Grand Total. Then I want to calculate the percentage of the Total column against the Grand Total Column. I know the mathematical equation would look something like
(Total / Grand Total)*100 but I do not know how to translate that into SQL language.

I wrote the folowing query:
SELECT      dbo.Counts.Product,
SUM(CASE WHEN MONTH(dbo.counts.MfgDate)=1 then dbo.counts.[count] else 0 end) as JAN,
SUM(CASE WHEN MONTH(dbo.counts.MfgDate)=2 then dbo.counts.[count] else 0 end) as FEB,
SUM(CASE WHEN MONTH( dbo.counts.MfgDate)=3 then dbo.counts.[count] else 0 end) as MAR,
SUM(CASE WHEN MONTH(dbo.counts.MfgDate)=4 then dbo.counts.[count] else 0 end) as APR,
SUM(CASE WHEN MONTH(dbo.counts.MfgDate)=5 then dbo.counts .[count] else 0 end) as MAY,
SUM(CASE WHEN MONTH(dbo.counts.MfgDate)=6 then dbo.counts.[count] else 0 end) as JUN,
SUM(CASE WHEN YEAR(dbo.counts.MfgDate)=2006 then dbo.counts.[count] else 0 end) as Total,

Which gives me the following results:
Product            JAN      FEB      MAR      APR      MAY      JUN      Total
-------------------      ---      ---      ---      ---      ---      ---      ---
RED JELLY BEANS      0      0      1      0      0      0      1
BLUE JELLY BEANS      0      1      0      0      0      0      1
PURPLE Jelly Beans      11      5      0      0      0      0      16
BLACK JELLY BEANS      32      18      0      0      0      0      50
[+][-]02/15/06 03:54 PM, ID: 15966526

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/15/06 03:57 PM, ID: 15966536

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/15/06 04:22 PM, ID: 15966793

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/15/06 04:56 PM, ID: 15967040

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/16/06 08:35 AM, ID: 15972335

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/17/06 01:29 AM, ID: 15978821

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/17/06 08:03 AM, ID: 15981781

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/17/06 02:36 PM, ID: 15985595

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/17/06 04:16 PM, ID: 15986119

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/17/06 10:44 PM, ID: 15987484

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/17/06 11:12 PM, ID: 15987572

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Tags: calculate, sql
Sign Up Now!
Solution Provided By: folderol
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02/17/06 11:24 PM, ID: 15987587

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/17/06 11:36 PM, ID: 15987608

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/17/06 11:37 PM, ID: 15987609

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74