急死我了~~表aa
开始日期bdate varchar(50) 如2007-05-01
结束日期edate varchar(50) 如2007-06-26想得到如下结果select rqzt = ????
日期区间已经过了今天--- 上例即是 则为 执行完毕
日期区间包含今天 ------------- 则为 执行中
日期区间在今天以后 ------ 则为 未执行
怎么弄???
开始日期bdate varchar(50) 如2007-05-01
结束日期edate varchar(50) 如2007-06-26想得到如下结果select rqzt = ????
日期区间已经过了今天--- 上例即是 则为 执行完毕
日期区间包含今天 ------------- 则为 执行中
日期区间在今天以后 ------ 则为 未执行
怎么弄???
你想得到什么东西
表aa结构是什么
--结束
else if edate = convert(varchar(10), getdate(), 120)
--执行中
else
--未执行
select rqzt=case when convert(varchar(10),getdate(),121)>convert(varchar(10),cast(edate as datetime),121) then '执行完毕' when convert(varchar(10),getdate(),121),convert(varchar(10),cast(edate as datetime),121) then '未行完毕' else '执行中' end from tablename
when datediff(dd,bdate,getdate())>0 and datediff(dd,edate,getdate())<0 then '执行中'
when datediff(dd,bdate,getdate())<0 then '执行完毕'
end
from 表aa