【问题标题】:Inner Join and Interval?内连接和间隔?
【发布时间】:2021-06-16 13:13:16
【问题描述】:

我有两张桌子 meteor_Events 和 video_Events 常用字段是日期和时间

我想搜索日期和时间与任何视频事件匹配的meteor_events,因此使用此查询可以正常工作

SELECT
meteor_events.event_id,
meteor_events.fname,
meteor_events.date,
meteor_events.Time
FROM
Video_Events
INNER JOIN
meteor_events
ON
    Video_Events.Date = meteor_events.date AND
    Video_Events.Time = meteor_events.Time

我现在想改进这一点,并带回日期匹配但时间匹配的结果,如果 meteor_events.Time 是正负 2 秒的话

即,如果 Video_Events.Time 是 00:12:34,如果 meteor_events.Time 介于 00:12:32 和 00:12:36 之间,则返回结果

我想我需要使用 Interval 但不确定?

感谢指点

亲切的问候 约翰·伯曼

【问题讨论】:

    标签: mysql inner-join intervals


    【解决方案1】:

    如此合乎逻辑的想法让我到了那里,我添加了这个

    Video_Events.Time -meteor_events.Time 介于 -2 和 2 之间

    问候约翰 B

    【讨论】:

      猜你喜欢
      • 2021-03-31
      • 2017-02-28
      • 2018-09-21
      • 2013-03-02
      • 1970-01-01
      • 2020-11-16
      • 2021-02-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多