Oracle get previous day records
- by Phill Pafford
Ok I think I'm getting the previous year instead of the previous day, but I need to previous day.
SELECT TO_DATE(TO_CHAR(CURRENT_DATE, 'YYYY-MM-DD'),'YYYY-MM-DD') - 1 FROM Dual
I'm comparing it to a datetime stamp in this format and wish to get all the rows from the previous day.
YYYY-MM-DD HH:MM:SS
So I'm trying something like this
SELECT field,datetime_field
FROM database
WHERE datetime_field > TO_DATE(TO_CHAR(CURRENT_DATE, 'YYYY-MM-DD'),'YYYY-MM-DD') - 1