如何在PostgreSQL的jdbc中设置"5天"(日期时间间隔)? [英] How to set '5 day' (datetime interval) in jdbc for PostgreSQL?
本文介绍了如何在PostgreSQL的jdbc中设置"5天"(日期时间间隔)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑以下示例
select * from foo where time +'10 day' >current_timestamp
我想将此查询参数化为Java,但我不知道如何设置10 day
?! (字符串不起作用)
I would like to make this query parametrized for Java, and I don't know how to set the 10 day
?! (String doesn't work)
推荐答案
select * from foo where time +'10 day'::interval >current_timestamp;
这篇关于如何在PostgreSQL的jdbc中设置"5天"(日期时间间隔)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文