标签: sql postgresql postgresql-9.3
我需要找到如何提取日期
然后在之间使用语句
:日期是用户的输入
select userID,:date,reportid from usertable where userID = '120429' and :date between (:date-30 days) and (:date +30 days)
答案 0 :(得分:2)
您可以使用date/time arithmetic operators。
:date + interval '30 days'
或
:date - interval '30 days'