|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 11/5/2008 12:43:58 AM
Posts: 3,
Visits: 18
|
|
This line of code is dividing two previous columns in my table and displaying the result as a %. However, if the correct answer to the division is 58.75% the calculation is displaying the result as 58.00%. This is throwing all my results off.
CAST((COALESCE(PAYPAL.PP_GMB_AUD,0)) AS DEC (18,2)) / CAST((COALESCE(TOTAL.TOTAL_GMB_AUD,0)) AS DEC (18,2)) AS PP_GMB_CONV
Can someone suggest how the results get displayed as they should.
THANKS - dbread007
|
|
|
|
|
Supreme Being
      
Group: Forum Members
Last Login: 11/25/2008 1:20:39 PM
Posts: 91,
Visits: 119
|
|
|
Looks like something is casting as integer. You must have left something out of the code you included - calculating a percent would result in .58 and not 58.0. Are you multiplying by 100? If so be sure to case the literal 100 as decimal.
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 8/27/2008 5:18:42 AM
Posts: 11,
Visits: 47
|
|
As Jeff pointed out your calculation is giving 0.5875 but casetd as decimal ( 18,2) which is 0.58 and this multiplied by 100 or 100.00 will give you 58%. better try castingas float to get accurate answers.
Latesh
|
|
|
|