You are viewing a single comment's thread. Return to all comments →
the bug is with avg fucntion. it return an integer without any decimal.
So correct solution for MSSQL is select CEILING(AVG(CAST(SALARY as DECIMAL(9,2))) - AVG(CAST(REPLACE(Salary,'0','') as DECIMAL(9,2)))) from EMPLOYEES
Seems like cookies are disabled on this browser, please enable them to open this website
The Blunder
You are viewing a single comment's thread. Return to all comments →
the bug is with avg fucntion. it return an integer without any decimal.
So correct solution for MSSQL is select CEILING(AVG(CAST(SALARY as DECIMAL(9,2))) - AVG(CAST(REPLACE(Salary,'0','') as DECIMAL(9,2)))) from EMPLOYEES