开发者

SQL retrieve yearly repeated event

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜