Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: %%How to <efficiently> do: SELECT MAX(Date)...WHERE Date < myParamDate
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
![]() |
![]() |