Re: %%How to <efficiently> do: SELECT MAX(Date)...WHERE Date < myParamDate
From: replace this with _at_ <martinj>
Date: 1997/10/14
Message-ID: <34428f25.4943077_at_news.xs4all.nl>#1/1
ORDER BY RDATE; One cursor, one sort, one full table scan (unless you have an index on rdate).
Date: 1997/10/14
Message-ID: <34428f25.4943077_at_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).
- Martin Jesterhoudt
- martinj(replace this by _at_)xs4all.nl
