我记得有一个sql语句可以解决,但忘记了,请各位大虾帮个忙。 ------------------------------------------------支持用case when then else end语句.
case when then when then else end
case when then when then else end
case when ....then ..... when ....then ..... else ... end
select employeeId,hours=isnull(case when hours is not null then hours*1 end ,''), wages=isnull(case when wages is not null then wages*1 end ,''), months=isnull(case when months is not null then months*1 end,''), salarys=isnull(case when salarys is not null then salarys*1 end,'') from table
employeeId hour wages month salary
雇员ID 小时工资 周薪 月薪 年薪 如何写一个Select 语句,
当雇员是小时工资时,用他工作的小时×hour
当雇员是周薪时,用他工作的周数×wages
我记得有一个sql语句可以解决,但忘记了,请各位大虾帮个忙。
------------------------------------------------支持用case when then else end语句.
when then
else
end
when ....then .....
else ...
end
wages=isnull(case when wages is not null then wages*1 end ,''),
months=isnull(case when months is not null then months*1 end,''),
salarys=isnull(case when salarys is not null then salarys*1 end,'')
from table