[英]Access SELECT Where Field More than X Days ago
This query appears to be returning ALL rows and not just those more than 3 days old (ie the date in Created On field) 该查询似乎返回所有行,而不仅仅是返回超过3天的行(即“创建日期”字段中的日期)
SELECT * FROM Master WHERE [Created On] < (Date()-3);
I don't see what is wrong with it. 我看不出有什么问题。
EDIT - this worked as expected (sorry my question was badly worded) 编辑-这按预期工作(对不起我的问题措辞不好)
SELECT * FROM Master WHERE [Created On] > (Date()-3);
Just changed the < to > ie all records that are more recent than 3 days ago. 只需将<更改为>,即比3天前更新的所有记录。
I reproduced your SELECT command and it's apparently correct. 我转载了您的SELECT命令,这显然是正确的。 In my case the query worked perfect.
在我的情况下,查询工作完美。 Try to execute this select to see the result of the
(Date() -3)
from three days ago. 尝试执行此选择以查看三天前的
(Date() -3)
3 (Date() -3)
结果。 For example: 例如:
SELECT Date(), Date() -3, *
FROM Master
WHERE [Created On]<(Date()-3);
Follow the link with more information about Date() function for MS-Access: https://support.office.com/en-us/article/Examples-of-using-dates-as-criteria-in-Access-queries-aea83b3b-46eb-43dd-8689-5fc961f21762 跟随链接,获取有关MS-Access的Date()函数的更多信息: https : //support.office.com/en-us/article/Examples-of-using-dates-as-criteria-in-Access-queries- aea83b3b-46eb-43dd-8689-5fc961f21762
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.