Microsoft Access SQL查询忽略年份的日期范围

时间:2013-10-06 10:08:24

标签: sql ms-access

我需要根据一系列月/日值选择记录,而忽略年份。我正在查询Access数据库,我发现了一个查询here,但它似乎选择了一系列年份。

SELECT *
FROM   Factory
WHERE  YEAR(date) BETWEEN 1998 AND 1999 

我尝试过此查询,但它只显示当年的生日:

SELECT * FROM user where birthday Between #09/05# and #10/10#;

在我的数据库中,生日列包含计算它们年龄的年份。我可以使用什么查询来执行我想要的操作?

2 个答案:

答案 0 :(得分:3)

尝试

SELECT * FROM user 
WHERE (month(birthday) * 100) + day(birthday) between 0131 and 1231

答案 1 :(得分:0)

试试这个。

SELECT * 
FROM user 
WHERE birthday between #1991/12/31# and #1992/01/31#;

OR

SELECT * 
FROM user 
WHERE birthday between #12/31/1991# and #01/31/1992#;  

OR

SELECT * FROM 
user
WHERE birthday between #1991/12/31# and #1992/01/31#