sql访问如何在日期之间返回 [英] sql access how to return between dates
本文介绍了sql访问如何在日期之间返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在 MS Access 中指定日期范围?以下查询是否正确?我是否必须将 "2/1/2010"
放在引号中?或者我必须做类似 date(2/1/2010)
的事情吗?
How do I specify a date range in MS Access? Is the below query correct? Do I have to put "2/1/2010"
in quotes? Or do I have to do something like date(2/1/2010)
?
SELECT [Occurrence Number] as Fld
FROM [Lab Occurrence Form]
WHERE [Practice Code]="ACCIM"
AND [1 0 Preanalytical (Before Testing)]="1.1 Specimen Mislabeled"
AND ([Occurrence Date] Between 2/1/2010 and 2/28/2010);
以下给了我一个类型不匹配
the following gives me a type mismatch
SELECT [Occurrence Number] as Fld FROM [Lab Occurrence Form] WHERE [1 0 Preanalytical (Before Testing)]="1.1 Specimen Mislabeled" AND [Occurrence Date] between "1/1/2009" and "2/2/2010";
推荐答案
ms-access 使用 Jet 引擎,它使用 # 作为日期文字:
ms-access uses the Jet engine which uses # for date literal:
SELECT Orders.*
FROM Orders
WHERE Orders.OrderDate Between #3/1/96# And #6/30/96#;
这篇关于sql访问如何在日期之间返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文