select case when [hour] is not null then [hour]*小时 case when .. end from tb     

解决方案 »

  1.   

    case ... when ... then ... else ... end
      

  2.   

    表结构如下: 
     employeeId   hour     wages month salary 
     雇员ID       小时工资  周薪   月薪   年薪 如何写一个Select 语句, 
    当雇员是小时工资时,用他工作的小时×hour 
    当雇员是周薪时,用他工作的周数×wages 
     
    我记得有一个sql语句可以解决,但忘记了,请各位大虾帮个忙。
    ------------------------------------------------支持用case when then else end语句.
      

  3.   

    case when  then 
         when  then 
         else
         end
      

  4.   

    case when then when then else end
      

  5.   

    case when ....then .....
         when ....then .....
         else ...
    end
      

  6.   

    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 
      

  7.   

    select case ... when ...end else ... end from ...