How to fetch records from DB2 for the last 7 days

2019-09-24 10:24发布

问题:

I am using DB2. I want to fetch records for this week from a column. I want to use similar to below (This is for SQL 2005)

Select count(*) from Applications WHERE ReceivedDate is this week. (Last 7 days including today)

回答1:

Try a WHERE clause like this:

WHERE ReceivedDate > current date - 7 days