我正在尝试编写一个查询,以获取在一组 30 秒长的时间之间发生的事件。
例子:
如果我使用这个查询:
SELECT videotime FROM codes
WHERE participant = 2 AND (retrospective ='y' AND forks > 0)
输出:
00:16:30.000
00:21:00.000
00:21:30.000
00:27:00.000
00:38:30.000
然后我想在 00:16:31、00:16:32 以及 00:21:01、00:27:29.999 等从另一个表获取事件。
到目前为止我写的内容只匹配第一行(00:16:30),但我希望能够使其匹配更多。
SELECT id, videotime FROM commands WHERE participant = 2 AND
videotime >= (SELECT videotime FROM codes
WHERE participant = 2 AND (retrospective ='y' AND forks > 0) ) AND
videotime <= time((SELECT videotime FROM codes
WHERE participant = 2 AND (retrospective ='y' AND forks > 0) ), '+30 seconds');
上面的输出不正确:
28 00:16:31.021
29 00:16:31.635
30 00:16:34.948
31 00:16:35.004
32 00:16:37.101
33 00:16:37.144
34 00:16:37.992
35 00:16:38.029
36 00:16:42.740
37 00:16:42.910
38 00:16:43.724
39 00:16:49.756
40 00:16:49.836
41 00:16:58.788
42 00:16:58.834
43 00:16:59.936
我需要做什么来解决这个问题?