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: %%How to <efficiently> do: SELECT MAX(Date)...WHERE Date < myParamDate

Re: %%How to <efficiently> do: SELECT MAX(Date)...WHERE Date < myParamDate

From: replace this with _at_ <_at_)xs4all.nl>
Date: 1997/10/14
Message-ID: <34428f25.4943077@news.xs4all.nl>#1/1

On Mon, 13 Oct 1997 00:47:15 -0400, "Sid Soni" <soni_at_spam.mindspring.com> wrote:

>If i want to determine what the rating was at 2/15/97 (it was updated to 4
>on 2/1/97) I can do the following:
>
>select rating from rating_tbl where rdate =
>(select max(rdate)
>from rating_tbl
>where rdate < to_date('2/15/97','MM-DD-YYYY'));
>
>Can I be more efficient & do this w/o a subselect?

SELECT	RATING
FROM	RATING_TBL
WHERE	RDATE > TO_DATE('2/15/97','MM-DD-YYYY')
AND	ROWNUM < 2

ORDER BY RDATE; One cursor, one sort, one full table scan (unless you have an index on rdate).
Received on Tue Oct 14 1997 - 00:00:00 CDT

Original text of this message

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