使用SQL中的getdate()函数获取今天的过期数据 [英] Getting Today's Expired Data with getdate() Function in SQL
本文介绍了使用SQL中的getdate()函数获取今天的过期数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
如何在SQL中使用日期列获取过期数据.
我正在尝试这个查询
Hai all,
How to get expired data(s) with a date column in SQL.
I am try this query
Select * from MyTable where Date <= getdate()
请帮助我..
please help me..
推荐答案
这将获得所有通过细粒度日期传递记录的记录(您可以使用d
代替m
天):
This will get all the records where the date is passed by a minute granularity (you can used
instead ofm
for days):
select * from MyTable where DateDiff(m,date,getdate()) > 0
这篇关于使用SQL中的getdate()函数获取今天的过期数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文