sql access如何在日期之间返回 [英] sql access how to return between dates

查看:69
本文介绍了sql access如何在日期之间返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在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 use the Jet engine which uses # for date literal:

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

这篇关于sql access如何在日期之间返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆