开发者

SQL retrieve yearly repeated event

开发者 https://www.devze.com 2023-01-08 15:49 出处:网络
How to write a sql statement to retriev开发者_开发知识库e repeated yearly event, which mean retrieve all the event regardless year only match with month and date.

How to write a sql statement to retriev开发者_开发知识库e repeated yearly event, which mean retrieve all the event regardless year only match with month and date.

Select * from Event where [date] = date ?


You can use the DAY() and MONTH() functions on a date field

SELECT * FROM Event WHERE MONTH(Date) = '7' AND DAY(Date) = '4' 

That would get you all events that happen on the 4th of July, regardless of the year.


You can use MONTH() and DAY() for this:

SELECT
    *
FROM
    Event
WHERE
    MONTH([date]) = 12
AND
    DAY([date]) = 25
0

精彩评论

暂无评论...
验证码 换一张
取 消