We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT @A = CEILING(AVG(Salary)) FROM Employees WHERE SALARY < 100000;
SELECT @B = CEILING(AVG(cast(replace(cast(Salary as varchar(max)), '0', '') as numeric(16,4)))) FROM Employees WHERE SALARY < 100000;
The Blunder
You are viewing a single comment's thread. Return to all comments →
I tried this for MS SQL:
declare @A as int; declare @B as int;
SELECT @A = CEILING(AVG(Salary)) FROM Employees WHERE SALARY < 100000; SELECT @B = CEILING(AVG(cast(replace(cast(Salary as varchar(max)), '0', '') as numeric(16,4)))) FROM Employees WHERE SALARY < 100000;
SELECT @A-@B;
It returns 2251. I tried other stuff and 2250 and 2251 were not accepted.