Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    14

    Unanswered: Round Statement Incorrect Value

    Hello,

    I am having trouble getting the correct calculation with the statement below. The error is that QTR4 is being divided by Select SUM instead of all 4 quarters. I have tried closing the addition statements but get errors on all scenarios that Ive tried. How can I format this to correctly to add up all 4 quarters then do the division?

    SELECT campus.campus,
    ROUND(QTR1+QTR2+QTR3+QTR4/(SELECT SUM(QTR1+qtr2+qtr3+qtr4) FROM campus),2) "% CONT"
    FROM campus;

    CAMPUS % CONT
    ------ ----------
    Main 1300.16
    East 700.08
    West 300.04
    North 350.04

  2. #2
    Join Date
    Oct 2003
    Location
    Switzerland
    Posts
    140
    What do you mean by "closing the addition statement". Shouldn't you to put parenthesis over QTR1+QTR2+QTR3+QTR4 ?

    SELECT campus.campus,
    ROUND((QTR1+QTR2+QTR3+QTR4)/(SELECT SUM(QTR1+qtr2+qtr3+qtr4) FROM campus),2) "% CONT"
    FROM campus;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •