Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Finding a date
Hi,
Try the following
select a.col1
from tab1 a
where not exists
(select col1
from tab1 where col1 < a.col1 and (a.col1-col1) <7) and exists
(select min(col1)
from tab1 where col1 < a.col1 and (a.col1-col1) >=7)
You'll need to change the table name and column names as per your table structure. The test table had following data.. COL1 COL2
--------- ---------- 24-OCT-02 10 23-OCT-02 10 22-OCT-02 10 21-OCT-02 10 12-OCT-02 10 11-OCT-02 10 29-SEP-02 10 28-SEP-02 10
and the above query gave the following result. COL1
21-OCT-02 11-OCT-02 28-SEP-02
HTH
Bhooshan
Received on Thu Oct 24 2002 - 00:26:42 CDT
![]() |
![]() |