Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Finding a date

Re: Finding a date

From: Bhooshan S. Prabhu <bhooshanprabhu_at_indiatimes.com>
Date: 23 Oct 2002 22:26:42 -0700
Message-ID: <e9d6edea.0210232126.5a5d4929@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US