Home » SQL & PL/SQL » SQL & PL/SQL » select the row effective by a given date
select the row effective by a given date [message #20084] Mon, 29 April 2002 11:50 Go to next message
Colin
Messages: 6
Registered: April 2001
Junior Member
The idea of the query doesn't sound very difficult and I believe it should be figured previously. But I need some help.

Suppose you have a table InterestRate having content as

rate startDate
0.02 1/1/2002
0.025 2/1/2002
0.021 3/1/2002
0.019 4/1/2002

This talbe doesn't have a stopdate column, because the next startdate will be the stop date of the previous entry.

So what is select sql query that will give you the rate that is effective for a given date, say 2/15/2002.

Thanks.
Re: select the row effective by a given date [message #20085 is a reply to message #20084] Mon, 29 April 2002 12:08 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
select rate
  from interestrate
 where startdate = (select max(startdate)
                      from interestrate
                     where start_date < :thedate);
Previous Topic: select and insert same time
Next Topic: dynamic sql and bulk collect problem
Goto Forum:
  


Current Time: Fri Apr 26 00:25:49 CDT 2024