gpt4 book ai didi

mysql:选择之间

转载 作者:行者123 更新时间:2023-11-29 07:11:36 25 4
gpt4 key购买 nike

我无法使用群组功能,不确定问题出在哪里

预期结果是从最大可用开始的 xxx 秒内的时间戳列表

请指教。

SELECT timestamp, response_time FROM resultsWHERE id = XYZ AND timestamp between (SELECT MAX(timestamp) FROM results inn WHERE id = 22) AND (SELECT timestamp FROM results WHERE id =22 AND timestamp = MAX(timestamp) - XXX)ORDER BY timestamp DESC

谢谢

最佳答案

SELECT  timestamp, response_time
FROM results
WHERE id = @xyz
AND timestamp BETWEEN
(
SELECT MAX(timestamp)
FROM results
WHERE id = 22
) AND
(
SELECT MAX(timestamp)
FROM results
WHERE id = 22
) - @xxx
ORDER BY
timestamp DESC

确保您在 (id, timestamp) 上有一个索引,以便快速运行。

关于mysql:选择之间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4154867/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com