Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select Last 7 days

AhmedMay 6 2010 — edited May 6 2010
How can I select last 7 days from my table, I use query but it is calculating according to sysdate
It is the data of my talble
DP_DATE
---------
03-APR-10
21-APR-10
22-APR-10
23-APR-10
26-APR-10
27-APR-10
28-APR-10
29-APR-10
30-APR-10
03-MAY-10
04-MAY-10

11 rows selected.
  select distinct dp_date
  from dailyprice
  where trunc(dp_date) between trunc(sysdate-7) and trunc(sysdate)

this query is returning 
DP_DATE
---------
29-APR-10
30-APR-10
03-MAY-10
04-MAY-10
I want to select last 7 days
26-APR-10
27-APR-10
28-APR-10
29-APR-10
30-APR-10
03-MAY-10
04-MAY-10

kindly guide

regards
This post has been answered by 009 on May 6 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2010
Added on May 6 2010
8 comments
5,441 views