如何在日期范围之间找到生日和周年纪念日。 [英] How do I find Birthday's and anniversary between a date range.
本文介绍了如何在日期范围之间找到生日和周年纪念日。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取所有在日期范围内拥有生日的记录。
I want to fetch all the records which have the birthday within a date range.
推荐答案
这是显示1-nov到15 dec之间的生日的示例今年
This is an example of showing birthdates between 1-nov to 15 dec of this year
select distinct Birthdate from T_staff where Birthdate between cast(cast(11 as varchar)+'-'+cast(1 as varchar)+'-'+cast(year(getdate()) as varchar) as datetime) and cast(cast(12 as varchar)+'-'+cast(15 as varchar)+'-'+cast(year(getdate()) as varchar) as datetime)
我只想回答:如何找到给定日期范围之间的生日 [< a href =http://www.codeproject.com/Answers/759078/How-do-I-find-the-birthdays-between-a-given-date-rtarget =_ blanktitle =新窗口> ^ ]。
-SA
I just tried to answer: How do I find the birthdays between a given date range[^].
—SA
这里我给出了一个简单的例子。请仔细阅读。
Here I have given a simple example.Please go through it.
select Birthdate from T_staff where Birthdate between fromdate and todate
这篇关于如何在日期范围之间找到生日和周年纪念日。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文