问题描述
列 states 是 jsonb。
状态示例(json)
[
{
"dt": "2020-12-23T16:15:18.405+00:00","id": "order.new","data": {}
}
]
当前日期为 2020 年 12 月 23 日,当前时间为 20:26。
现在我想显示 modified_at > 900 秒(15 分钟)和 states->0->'id' = 'order.new'
我试试这个:
SELECT id,modified_at,states->0 as state FROM shop_order
WHERE (states ->0 @> '{"id":"order.new"}')
AND (extract(epoch from CURRENT_TIMESTAMP - modified_at)::integer > 900)
结果为空
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)