0

Basically, i want to go back one day and find the data using query...

This is what i have so far:

 select price from SAMPLE_DATA 
 where trunc(date) = '11-FEB-13'

However, when i tried using:

 select price from SAMPLE_DATA 
 where trunc(date) = trunc(date-1)

this doesn't return anything. So is there anything wrong?

Thanks

4

1 回答 1

6

You're comparing the date in the record with the date previous to the date in the record. At no point are you using the current date as a reference. Try this instead:

select mid_price from SAMPLE_DATA where trunc(business_date) = trunc(sysdate-1)
于 2013-06-26T19:35:44.617 回答