RE: SQL - Calculate 100%

  • From: "Mercadante, Thomas F (LABOR)" <Thomas.Mercadante@xxxxxxxxxxxx>
  • To: "ecandrietta@xxxxxxxxx" <ecandrietta@xxxxxxxxx>, Adam Musch <ahmusch@xxxxxxxxx>
  • Date: Fri, 26 Nov 2010 17:33:03 -0500

Eriovaldo,


If you round your results then the sum is correct:

3,70 is really 3,7064 and would round to 3,71 - right?

round(value1/value2,2)*100




________________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [oracle-l-bounce@xxxxxxxxxxxxx] On Behalf 
Of Eriovaldo Andrietta [ecandrietta@xxxxxxxxx]
Sent: Thursday, November 25, 2010 6:18 PM
To: Adam Musch
Cc: ORACLE-L
Subject: Re: SQL - Calculate 100%

Great Adam,

 It solved part of my issue.
 The ratio_to_report helped when I have this situation:

   10,90
     3,70
    85,39
  (only one column)

 but I also have the situation

  col1         col2       col3
   --------      --------     --------
  10,90      3,70       85,39 --> the sum must be 100%
   (three different columns)

Any other clue ?

I am trying to use DECODE , but the code will not be clear.

Best Regards
Eriovaldo

On Thu, Nov 25, 2010 at 3:08 PM, Adam Musch 
<ahmusch@xxxxxxxxx<mailto:ahmusch@xxxxxxxxx>> wrote:
The RATIO_TO_REPORT analytic function appears to be what you're looking for.


On Thu, Nov 25, 2010 at 3:57 AM, Eriovaldo Andrietta 
<ecandrietta@xxxxxxxxx<mailto:ecandrietta@xxxxxxxxx>> wrote:
Hi friends,

 I have the following situation:

Value1                     Value2        Value2 / Value1 = Percent

4128,00 450,00  10,90
4128,00 153,00  3,70
s4128,00        3525,00 85,39

Sum Percent ------------------->                    99,99

The sum of percent is not 100% ...

  Is there any SQL instruction that does this calculation and adjust the value 
to 100% ?

Regards
Eriovaldo



--
Adam Musch
ahmusch@xxxxxxxxx<mailto:ahmusch@xxxxxxxxx>


--
//www.freelists.org/webpage/oracle-l


Other related posts: