一尘不染

sql access如何在日期之间返回

sql

如何在MS Access中指定日期范围?以下查询正确吗?我必须加"2/1/2010"引号吗?还是我必须做类似的事情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);

以下给我一个类型不匹配

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";

阅读 148

收藏
2021-05-05

共1个答案

一尘不染

ms-access使用Jet引擎,该引擎使用#表示日期文字:

SELECT Orders.*
  FROM Orders
 WHERE Orders.OrderDate Between #3/1/96# And #6/30/96#;
2021-05-05