我有一个查询
delete from qdocs where path < './qbin/arch/2014-08-01' + and path > './qbin/arch'
需要制作像
这样的变量delete from qdocs where path < './qbin/arch/current_date - 31 day' + and path > './qbin/arch'
答案 0 :(得分:0)
您可以使用下面的date/time functions:
delete from qdocs where path < './qbin/arch/' || current_date - 31 and path > './qbin/arch'
有更多可能的方法来修改日期:
select current_date - integer '31';
select (current_date - interval '31 days')::date;
select (current_date - interval '1 month')::date;