[学习笔记]Sql提前30天提醒信息

来源:互联网 发布:宣州太守知不知 编辑:程序博客网 时间:2024/06/10 01:14
select *,datediff(day, (dateadd(month,0,getdate())),CertificateTime),Rmind=case 
when ( CertificateTime between getdate() and dateAdd(dd,30,getdate())) then ('请注意,您的健康证即将到期') 
when datediff(day, (dateadd(month,0,getdate())),CertificateTime)<=0 then ('请注意,您的健康证已过期')
else '' 
end
from HealthCertificate
0 0
原创粉丝点击