How do I select rows with a timestamp value at any time yesterday? The DBMS is DB2.
SELECT *
FROM my_table
WHERE CAST (my_timestamp_col AS DATE) = CURRENT DATE - 1 DAY
This is what I currently have but is casting timestamps as date inefficient? Can it make use of indexes?
I would instead recommend:
where my_timestamp_col >= current date - 1 day and
my_timestamp_col < current date