如何在日期间隔中正确使用此类查询?
@SqlUpdate("delete fromlogin where created < now() - ':days days' :: interval")
void deleteOldLogin(@Bind("days") Period days);发布于 2018-09-24 14:40:55
不能将间隔常数内的天数作为参数传递。您需要传递一个指定天数的整数,然后将其乘以所需长度的间隔。
@SqlUpdate("delete fromlogin where created < now() - :days * '1 day'::interval")发布于 2019-07-26 16:56:34
Jdbi现在支持将java.time.Duration类型绑定为interval:https://github.com/jdbi/jdbi/pull/670
https://stackoverflow.com/questions/52480996
复制相似问题