select * from(
select fssj,dealresuit
case when fssj<dateadd(30,mi,getdate()) and dealresuit in('进行中','未完成') then 1
else 0 end 状态
from table
where fssj>DATEADD(24,hh,getdate())
select * from(
select fssj,dealresuit
case when fssj>dateadd(30,mi,getdate()) then 1
else 0 end 状态
from table
where fssj>DATEADD(24,hh,getdate())
)t
内容判断类似在外层也用case when
报表里用状态选择显示 如未完成的值是指空值的话
select * from(
select fssj,dealresuit
case when fssj<dateadd(30,mi,getdate()) and dealresuit is null then 1
else 0 end 状态
from table
where fssj>DATEADD(24,hh,getdate())
)t