gpt4 book ai didi

mysql - SQL : How can i find the records of a dataset that exist in a datetime range of 30 minutes for a column 'Created_at' ?

转载 作者:行者123 更新时间:2023-11-30 21:51:04 24 4
gpt4 key购买 nike

SELECT t1.depar_date, t1.return_date, t1.orig_air, t1.dest_air, t1.num_pass, count(t1.id) as count_of, 'TRUE' as Hit_Cache
FROM MY_TEST t1
WHERE t1.created_at BETWEEN t1.created_at AND dateadd(minute, 30, t1.created_at) --t1.created_at > dateadd(DAY, 1, t1.created_at)
GROUP BY t1.depar_date, t1.return_date, t1.orig_air, t1.dest_air, t1.num_pass
HAVING count(t1.id) > 1;

DATEADD 无法识别并抛出错误。

最佳答案

将 MINUTE 大写或使用小写的 mm:

SELECT t1.depar_date, t1.return_date, t1.orig_air, t1.dest_air,        t1.num_pass, count(t1.id) as count_of, 'TRUE' as Hit_Cache
FROM MY_TEST t1
WHERE t1.created_at BETWEEN t1.created_at AND dateadd(MINUTE, 30, t1.created_at) --t1.created_at > dateadd(DAY, 1, t1.created_at)
GROUP BY t1.depar_date, t1.return_date, t1.orig_air, t1.dest_air, t1.num_pass
HAVING count(t1.id) > 1;

关于mysql - SQL : How can i find the records of a dataset that exist in a datetime range of 30 minutes for a column 'Created_at' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47237654/

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