I am hoping that somebody can help me out with this question.
The following SQL returns just the records in a given table that are specifically 20 days from current.
Last_Mod_Date = TO_DATE(SYSDATE - 20)
Using 开发者_如何学编程similar theory can somebody help me determine how to return all records within the past 20 days range?
Thanks!
select
*
from
table
where
Last_Mod_Date >= trunc(sysdate-20);
SELECT *
FROM MY_TABLE
WHERE TO_DATE(my_ts_field) BETWEEN TO_DATE(SYSDATE-20) AND TO_DATE(SYSDATE)
Change the comparison to greater-than-or-equal:
Last_Mod_Date >= TO_DATE(SYSDATE-20)
精彩评论