sysdate is already a date, so if you want everything 13 days prior do:
select external_reporting_id ASIN, last_updated as "Received"
from transfer_delivery_items
where last_updated >= trunc(sysdate) -13
order by last_updated desc;
The trunc(sysdate)
will remove the time from the date, to encompass all records 13 days prior.
Note: I would not do
trunc(last_updated) >= trunc(sysdate)
because last_updaetd
is probably an indexed column and trunc(last_update)
will bypass that index. (unless there is a function index on trunc(last_updated)
.
Update:
To get the block of dates 13 days prior and no more than 13 days into the future do:
select external_reporting_id ASIN, last_updated as "Received"
from transfer_delivery_items
where last_updated >= trunc(sysdate) -13
and last_updated <= trunc(sysdate) +13
order by last_updated desc;