payjo

Senior member
Sep 6, 2001
267
0
0
Anyone know how to format mathematic expressions in SQL? I have a query that calculates the batting avg of a player:

select hits, atbats, (hits/atbats) as battingAVG
from PLAYERS
.....

battingAVG is coming out with only two decimals after it. I want three. I also want trialing zeros (eg. 0.600). Help please!!!

Thanks!!!

*EDIT*

Got it.
ROUND(X,D)
Returns the argument X, rounded to a number with D decimals. If D is 0, the result will have no decimal point or fractional part. :)