有一张表里的记录为
序号    关闭时间 需要得到的记录为
序号    使用状态
当 关闭时间 晚于 当前时间,则 使用状态 为“可使用”,否则为“不可使用”

解决方案 »

  1.   

    select 序号,关闭时间,case when 关闭时间>getdate() then '可使用' else '不可使用' end as 使用状态
    from tb
      

  2.   

    select
     序号,关闭时间,case when 关闭时间>getdate() then '可使用' else '不可使用' end as 使用状态
    from
     tb
      

  3.   

    select 序号,
        使用状态=case when 关闭时间>getdate() then '可使用' else '不可使用' end 
    from tb