Are there any MySQL functions to get all rows with with a start or end date that fall between a given start and end date?

前端 未结 5 2272
名媛妹妹
名媛妹妹 2020-12-06 12:48

I have a table of events with a recorded start and end time as a MySQL DATETIME object (in the format YYYY-MM-DD HH:MM:SS. I want to find all events that occur

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 13:21

    Llya, Roberts answer with,

    SELECT * FROM table WHERE start_date <= end_of_range AND stop_date >= start_of_range

    works fine with,

    D) events with both starting and ending dates outside the range, but overlapping it

    ??

提交回复
热议问题