|
View previous topic :: View next topic
|
| Author |
Message |
hnharish
New User
Joined: 30 Aug 2005 Posts: 23
|
|
|
|
Hi All,
I have written a DB2 sql query to calculate the average value of a column but the issue is the column is not returning Decimal value ex: if the avetrage value is 12.567 its returning the value as 12 i need atleast 2 decimal places to be shown ie. 12.56. Could you pls help me resolving this issue. Thanks in Advance.
Regards,
Harish |
|
| Back to top |
|
 |
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
the original column on which the average is calculated is probably integer.
try avg(dec(Col,10,2)) or avg(Col * 1.00) . Both will return you a decimal
if you want only 2 pos after the comma : dec(avg(Col * 1.00),10,2) |
|
| Back to top |
|
 |
|
|