AVG in Sql - Float number problem

NetSide picture NetSide · Jul 9, 2009 · Viewed 26k times · Source
SELECT     AVG(variable) AS Expr1, SUM(variable) AS Expr2
FROM       ......

result for AVG is 2, but it is not true, it must be 2.95. What is the problem, any idea?

Answer

user110714 picture user110714 · Jul 9, 2009

Try

Select
    AVG(Cast(variable as Float)),
    SUM(variable)
From
    Table