gpt4 book ai didi

postgresql - Postgres : how do I filter by a datetime field with infinity and -infinity?

转载 作者:行者123 更新时间:2023-11-29 11:42:43 24 4
gpt4 key购买 nike

我正在尝试创建一个选择查询,并过滤一个等于“无穷大”和“-无穷大”的日期时间字段:

SELECT * FROM mytable WHERE dt = <??? infitity ???> OR dt = <??? -infinity ???>

我该怎么做?

最佳答案

SELECT * 
FROM mytable
WHERE dt = 'infinity'
OR dt = '-infinity';

这假设 dt 是一个 DATETIMESTAMP 列。

您也可以明确说明这一点(以明确表明这不是错字):

SELECT * 
FROM mytable
WHERE dt = 'infinity'::timestamp
OR dt = '-infinity'::timestamp;

关于postgresql - Postgres : how do I filter by a datetime field with infinity and -infinity?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41120302/

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