sam sam sam sam - 2 months ago 9
SQL Question

simple code sql

can any body tell me why this code doesn't work, I get all employeegrade as 0

select Fname,lname, salary, salary =(
case when salary>0 and salary <5000 then 1
when SALARY>5000 and salary <7000 then 2
else 3 end )
employeegrade from employee;

Answer

try below code

 select Fname,lname, salary, 
(case when salary>0 and salary <5000 then 1 when salary >5000 and salary <7000   then 2 else 3  end) as employeegrade from employee;
Comments