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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Find the first record, for every day

Re: Find the first record, for every day

From: <sybrandb_at_yahoo.com>
Date: 21 Dec 2005 02:16:36 -0800
Message-ID: <1135160196.558704.168220@g14g2000cwa.googlegroups.com>


Assuming you have hh24:mm information in your date columns

select date_, status
from t1 x
where date_ =
(
select min(date_) from t1 y where trunc(y.date_) = trunc(x.date_) )
needless to say you would need a function based index on the date column or the statement will perform horribly, and won't scale.

Hth

-- 
Sybrand Bakker
Senior Oracle DBA
Received on Wed Dec 21 2005 - 04:16:36 CST

Original text of this message

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