SQL help - date sensitive price retrieval
Wierd.
If I do the following, I get the right date:
Select max(My_date) from Mytable
where MY_ID = 'A'
and My_date < '1988-27-04')
However if my data looks like this:
MY_ID MY_DATE PRICE
A 3/6/1987 12:00:00 AM 1
A 4/1/1988 12:00:00 AM 2
A 4/28/1989 12:00:00 AM 3
B 3/6/1987 12:00:00 AM 5
B 4/1/1988 12:00:00 AM 6
and I query using:
Select max(My_date), PRICE from Mytable
where MY_ID = 'A'
and My_date < '1988-27-04')
I get the right date (4/1/88) but get the first price (1)
How do I query to get the price corresponding to the date retrieved?
Subject
Written By
Posted
SQL help - date sensitive price retrieval
January 07, 2013 04:05PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.