Reputation: 191
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
Upvotes: 0
Views: 438
Reputation: 7066
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)
Upvotes: 6