Microsoft Access SQL查询忽略年份的日期范围 [英] Microsoft Access SQL to query a date range ignoring the year

查看:130
本文介绍了Microsoft Access SQL查询忽略年份的日期范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要根据月份/天的值范围(不考虑年份)来选择记录.我正在查询Access数据库,并且在此处找到了查询,但是似乎选择了一个年份范围.

I need to select records based on a range of month/day values, disregarding the year. I am querying an Access database, and I found a query here but it seems to select a range of years.

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

我已经尝试过该查询,但是它仅显示当年的生日:

I have tried this query, but it only shows birthdays in the current year :

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

在我的数据库中,生日列包含用于计算年龄的年份.我可以使用哪种查询来执行所需的操作?

In my database the birthday column contains the year to count how old they are. What query can I use to perform what I want?

推荐答案

尝试

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

这篇关于Microsoft Access SQL查询忽略年份的日期范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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