searchsanjaysharma
asked on
Why the difference comes in excel and sql server while using avg function,
The sample data is attached.
When i find the average using excel for set of observations the output varies in excel and sql server.Difference--in-Output.xlsx
When i find the average using excel for set of observations the output varies in excel and sql server.Difference--in-Output.xlsx
it's (the result) is being treated as an integer in your query, but that's not true in Excel.
see the difference this way perhaps:
select avg(data), avg(data*1.0) from table1
http://sqlfiddle.com/#!3/2efbb/2
select avg(data), avg(data*1.0) from table1
http://sqlfiddle.com/#!3/2efbb/2
SELECT AVG(CAST(DataIn as REAL)) AS FROM AVGTABLE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
thanks & cheers, Paul