解决方案 »

  1.   

    CASE WHEN Datediff(dd,actp.admiss_date,ISNULL(dis_date,GETDATE()))<>0
    THEN Datediff(dd,actp.admiss_date,ISNULL(dis_date,GETDATE()))
    ELSE 1 END zyts我帮你转化了一下,效果应该一样,你试下
      

  2.   


    case when actp.dis_date is null
           then Datediff(dd,actp.admiss_date,GETDATE())
         when actp.dis_date is not null
           then Datediff(dd,admiss_date,dis_date) 
         when (actp.dis_date is not null and Datediff(dd,admiss_date,dis_date)=0)  --如果出院时间dis_date和入院时间admiss_date相减得0,就赋值zyts为1
               or (Datediff(dd,admiss_date,getdate())=0)  --当前时间和入院时间相减得0
           then 1
         end 'zyts'